The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'.


	For example, "ACGAATTCCG" is a DNA sequence.


When studying DNA, it is useful to identify repeated sequences within the DNA.

Given a string s that represents a DNA sequence, return all the 10-letter-long sequences (substrings) that occur more than once in a DNA molecule. You may return the answer in any order.

&nbsp;
Example 1:
Input: s = "AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT"
Output: ["AAAAACCCCC","CCCCCAAAAA"]
Example 2:
Input: s = "AAAAAAAAAAAAA"
Output: ["AAAAAAAAAA"]

&nbsp;
Constraints:


	1 &lt;= s.length &lt;= 105
	s[i] is either 'A', 'C', 'G', or 'T'.


class Solution(object):
    def findRepeatedDnaSequences(self, s):
        """
        :type s: str
        :rtype: List[str]
        """
        seqs = {}
        i = 0
        while i+10 <= len(s):
            curr = s[i:i+10]
            if curr in seqs:
                seqs[curr] = seqs[curr] + 1
            else:
                seqs[curr] = 1
            i += 1

        repeats = []
        for seq in list(seqs.keys()):
            if seqs[seq] > 1:
                repeats.append(seq)

        return repeats
class Solution {
    public List<String> findRepeatedDnaSequences(String s) {
        HashMap<String,Integer> map =new HashMap();
        int i=0;
        int j=0;
        int k=10;
        StringBuilder sb=new StringBuilder("");

        while(j<s.length()){
            sb.append(s.charAt(j));
            if(j-i+1<k){
                j++;
            }else if(j-i+1==k){
                if(!map.containsKey(sb.toString())){
                    map.put(sb.toString(),1);
                }else{
                    map.put(sb.toString(),map.get(sb.toString())+1);
                }
                sb.deleteCharAt(0);
                i++;
                j++;
            }
        }
        List<String> list=new ArrayList();
        for(Map.Entry<String,Integer> mapElement:map.entrySet()){
            if(mapElement.getValue()>1){
                list.add(mapElement.getKey());
            }
        }
        return list;
    }
}
class Solution {
	public:
		vector<string> findRepeatedDnaSequences(string s) {
			unordered_map<string,int> freq;
			int start = 0 , end = 9;
			while(end < s.size()){
				bool flag = true;
				for(int i = start ; i <= end ; i++){
					if(s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T') continue;
					else {flag = false ; break ;}
				}
				if(flag){
					string temp = s.substr(start , 10);
					freq[temp]++;
				}
				start++;
				end++;
			}
			vector<string> ans;
			for(auto it : freq){
				if(it.second >= 2) ans.push_back(it.first);
			}
			return ans;
		}
};
// 187. Repeated DNA Sequences
var findRepeatedDnaSequences = function(s) {
    let map = {};
	let res = [];
	for (let i = 0; i <= s.length-10; i++) {
		let s10 = s.substring(i, i+10);
		map[s10] = (map[s10] || 0) + 1;
		if (map[s10] === 2) res.push(s10);
	}
	return res;
};
Repeated DNA Sequences