class Solution
{
public:
    vector<string> findRepeatedDnaSequences(string s)
    {
        if (s.size() < 10)
            return {};
        vector<string> ans;
        unordered_set<string> ss;
        unordered_set<string> t;
        for (int i = 0; i < s.size() - 9; ++i)
        {

            if (ss.count(s.substr(i, 10)))
            {
                if (!t.count(s.substr(i, 10)))
                {
                    ans.push_back(s.substr(i, 10));
                    t.insert(s.substr(i, 10));
                }
            }
            else
            {
                ss.insert(s.substr(i, 10));
            }
        }
        return ans;
    }
};
