leetcode187. 重复的DNA序列

class Solution {
public:
    vector<string> findRepeatedDnaSequences(string s) {
        unordered_map<string,int>map;
        vector<string> ans;
        int n=s.size();
        for(int i=0;i<=n-10;i++){
            string t=s.substr(i,10);
            if(++map[t]==2){
               ans.push_back(t);
            }
        }
        return ans;
    }
};