187. Repeated DNA Sequences Posted on 2018-07-26 | In leetcode | Visitors: Repeated DNA Sequences1234567891011121314151617181920212223242526272829303132333435#! /usr/bin/pythonclass Solution(object): def findRepeatedDnaSequences(self, s): """ :type s: str :rtype: List[str] """# print s l = len(s)# print l dict = {} for i in range(l-9):# print i substr = s[i:i+10] if dict.has_key(substr): dict[substr] = dict[substr] + 1 else: dict[substr] = 1# print dict list = [] for keys in dict.keys():# print keys if dict[keys] > 1: list.append(keys) print list return listif __name__ == "__main__": S = Solution() s = raw_input() S.findRepeatedDnaSequences(s)