-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfind pattern in text.py
9 lines (7 loc) · 8.81 KB
/
find pattern in text.py
1
2
3
4
5
6
7
8
9
text = 'AAACGAACCAACGAACCACGAACCGACGAACCAGACGAACCCAACGAACCAACGAACCGTTTACGAACCGCACGAACCCACGAACCTACGAACCCAACGAACCTCGTCAACGAACCGACGAACCACGAACCCACGAACCAGACGAACCGACGAACCACGAACCCACGAACCCGTACGAACCCAAAGACGAACCACACGAACCAGGACGAACCGCGTGAACGAACCACGAACCGGACGAACCGACGAACCACGAACCGACGAACCCACGAACCACGAACCTACGAACCACGAACCTGAGGACGAACCTTGTTACGAACCTATGTCACGAACCCACGAACCCTGGACGAACCAACGAACCAACGAACCACGAACCACGAACCGTACGAACCGATCCGGACCACGAACCTGACGAACCACGAACCTAACGAACCACGTACGAACCTACGAACCTCACGAACCCACGAACCACGAACCACGAACCCGCCTACCACGAACCTGGTTTGACGAACCACGAACCTAAACGAACCTACGAACCAAAAACGAACCGGTAGAGCACGAACCACGAACCACGAACCACGAACCTCACGAACCTACGAACCACGAACCCGTACGAACCGCCTATGGTAACGAACCCAACGACGAACCGACGAACCGACGAACCACGAACCCCCACGAACCGCTGTTTCGACATACGAACCCCACGAACCCACGAACCACGAACCACGAACCGCCACGAACCTTACGAACCACACGAACCCTCACGAACCGACGAACCACGAACCGCTATGGACGAACCGGGAAACTTGACGAACCCGCACGAACCACGAACCGGAGACACGAACCAACGAACCGGCTGAACGAACCTACGAACCAAGATGCTACGAACCTACGAACCTCTTGTACGAACCTTGCACGAACCTCGAACGAACCATTTCACGAACCTGAACGAACCGTTGACGAACCAACACGAACCACGAACCGGGGTATACGAACCCACGAACCACGAACCCACGAACCTACGAACCACGAACCTCTCGCTACGAACCACGAACCGAGTAAACTCACGAACCTCTTTGACGAACCACGAACCCGTCACGAACCTACGAACCCTACGAACCGATCAACGAACCCTACGAACCTTTGATAGCACGAACCATCGGTACACGAACCTCACAACGAACCGTAACGAACCAAGAAGATACGAACCTCTAACGAACCACGAACCCACGAACCACGAACCCACGAACCGACGAACCTCATACGAACCCCCTCCTACGAACCACGAACCACGAACCCACCTCACGAACCCGTAAAAAGCCGCACCAGACGAACCCACGAACCGGACGAACCACGAACCACTTGGCCGACGAACCACGAACCACGAACCACGAACCTATGGACGAACCACGAACCACGAACCGACGAACCAACGAACCCAGAAACGAACCTACGAACCGCAAAAAAACGAACCGGAGACGAACCTCACGAACCGTCTGCGACTAATACGAACCCACGAACCACGAACCATGAACGTACAAACGAACCGACACGAACCATGAACAGACGAACCCGCAGCGAAACGAACCACGAACCACGAACCTTGACGAACCACGAACCCGTGCTCGACGAACCGTTGACGAACCCGGCAAACGAACCCCACGAACCGGCGGGCACGAACCCTACGAACCCGGACGAACCATAACGAACCAACGAACCACGAACCCGTACACGAACCACGCACGAACCTAAAACGAACCACGAACCCACGAACCTCAACCTGACGAACCCTCACGAACCACGAACCACGAACCCCACGAACCCACGAACCCACGAACCGCTAACGAACCGTACGAACCGGTACGAACCACGAACCTGTGTGAAGAACGAACCTACGAACCACGAACCACGAACCGCACACGAACCACGAACCAACGAACCTCACGAACCACGAACCACGAACCACATAAACGAACCTGACGAACCACGAACCTGCACGAACCACGAACCGGTTACGAACCCTTACGAACCGCACGAACCACGAACCTTTGACGAACCACGAACCACGAACCCACGAACCCATCTACGAACCACGAACCTGTCGATGGGAACGAACCTACGAACCGACGAACCACTTTCACCGACGAACCTGACGAACCGACGAACCCCACGAACCTGAACGAACCACGAACCGACGAACCACGAACCCAAACGAACCTTACGAACCAAGGGAAGACGAACCACGAACCCCACCACGAACCACGAACCCAACGAACCAGTACGAACCATGACACGAACCAATCCTACGAACCAACGAACCACACACGAACCAACGAACCTGGGACGAACCACGAACCAACGAACCACGAACCACACGAACCTGCCATAGGACGAACCCACGAACCACACGCTACACGAACCTAGACGAACCACGAACCTACGAACCCATACTTGGAGCACGAACCACGAACCCGGACGAACCAAGGTGAACGAACCACGAACCACGAACCCACAACGAACCAACGAACCCACGAACCTCACGAACCACGAACCAAGTACGAACCACGAACCGTACGAACCACGAACCTCGCGACGAACCCACGAACCGCTACGAACCACGAACCACGAACCGCAACGAACCACACGAACCACGAACCACGAACCATCGGGAGCTGGGTACGAACCACGAACCACGAACCACGAACCGCCACGAACCGCACGAACCACGAACCACGAACCTACACGAACCCACGAACCAATGCACGAACCGGACGAACCACGAACCACGAACCACGAACCCGCCACGAACCGAAATCACGAACCAGAGTACGAACCTTACGAACCCGTACGAACCTACGAACCACGAACCTTTACTACGAACCACGAACCTTGACGAACCTTCAACGAACCACGAACCAATTAATACACGAACCACGAACCGGGTACGAACCACGAACCTCACGTACGAACCACGAACCTACGAACCATTTTTTCTCTGGACGAACCCACGAACCCAACGAACCGACGAACCGACGAACCCACGAACCCACGAACCACGAACCACGAACCACGAACCACGAACCACACGAACCCCAACGAACCATACGAACCACGAACCTTACGAACCCCGACGAACCGTAGACGAACCCGACGAACCACGAACCACGAACCACGAACCTGCACACGAACCACGAACCGACGAACCTACGAACCAGAACGAACCACGAACCACGAACCGCCCTTACGAACCACGAACCACACGAACCATACGAACCACGAACCACGAACCCACGAACCACGAACCTCGGACGAACCTTACGAACCGCAGACGAACCTTACGAACCGAGCACGAACCACGAACCCCACGAACCTACCAGACGAACCGTTTCGCCCAAGTAACGAACCCCCACGAACCAATTACGAACCCTACTTACGAACCAACGAACCGCCACGAACCGGGACGAACCACACGAACCACGAACCTGACGAACCACGAACCCTGCCATGACGAACCACGAACCGGGTGACGAACCGACGAACCTACGAACCGACGAACCTGACGAACCAACGAACCCGACGAACCGCCTGATGGACGAACCACTACGAACCAGGACGAACCGGGGTTTAGGAAACGAACCACGAACCACGAACCTAACGAACCACGAACCAGGACACGAACCACGAACCTACACGAACCACACGAACCACGAACCGACGAACCTACAACGAACCTAAGACACGAACCACGAACCCACGAACCTCACGAACCTTCACGAACCGACGAACCCTTTACGAACCGACGAACCCACGAACCACGAACCTAACACGACGAACCCACGAACCTCACGCACGAACCACGAACCACGAACCTTGAATTTACGAACCTCAAATACGAACCCCCGACGAACCGTCCTTTACAGAGAGACGAACCACGAACCAACGAACCACGAACCTCAACGAACCGGACGAACCACGAACCGCTAATCACGAACCCCAACGAACCGTACACGAACCACTACGAACCACGAACCCTACGCACGAACCACGAACCCTACGAACCACACGAACCAAACGAACCCTACGAACCTTCGTAGGTTTAGAACTACGAACCTACGAACCGAACGAACCCAAGACGAACCCCACGAACCCTCTTAAAACGAACCACGAACCCTACGAACCTTCGGGACGAACCAGACGAACCTGTGAGACGAACCTACGAACCAACGAACCGCTTGAGACGAACCAACGAACCACGAACCTTAACGAACCGCTCACGAACCCCCCCTACGAACCTACGAACCAACGAACCGTACGAACCACGAACCGAAACGAACCACGAACCACGAACCATTACGAACCGTGTTACGAACCACGAACCTCAAAACGAACCACGAACCAATCTAGGCGAAAAACGAACCCACGACGAACCATACGAACCTGACGAACCTTACGAACCAAATAGACGAACCAGGACGAACCACGAACCCAGACGAACCCACGAACCACGAACCTCGCACGGGTATACGAACCGTTACGAACCACGAATCACGAACCCACGAACCCTATACGAACCGCACATACGAACCACGAACCAACGAACCGACGAACCACGAACCAAACACGAACCCACGAACCGACGAACCCACAGCACGAACCACGAACCGCGACGTCACGAACCCACGAACCACGAACCAATAGCACCTATTGGACGAACCAACGAACCTAACAAACGAACCTCAACGAACCTACGAACCACGAACCTACGAACCAGACGAACCACGAACCAGACGAACCTACGAACCCTTAAACGAACCACGAACCCAGCTTTTACGAACCCGTACGAACCGACGAACCACGAACCGACGAACCACGAACCAAGATTAACGAACCACGAACCCGCGACGAACCTACTACGAACCCACGAACCGTACGAACCACGAACCGGTTAACGAACCACGAACCTGTACGAACCAAGACGAACCACGAACCTAACGAACCGAAAAACGAACCCCACGAACCACGAACCACGAACCGAACGAACCACCGCAGATGAACGAACCACGAACCACGAACCTGCGACGAACCTCTACAGATAGACCACGAACCGACGAACCACGAACCACTAACGAACCACGAACCACGAACCACGAACCGTGAGCGAAAGGAACACGAACCTTTACGAACCCACGAACCCTACGAACCGACGAACCAGCGACGAACCTACGAACCACGAACCGCCTAGAGGCTACGAACCGGACGAACCGCAAACGAACCCACGAACCGAACGAACCACGAACCGCCTTTACGAACCAGGCACGAACCTCCATGGACACGAACCACGAACCACGAACCGGCGACGAACCACCTGACGAACCAACGAACCTTCAACGAACCTGGTGCCTCGGCACGAACCCTCTGAACGAACCCACGAACCTTCAAATCCTTCTCAGACACGAACCGCGACGAACCAACGAACCAATGCAAGGATCGGACACGAACCCGACGAACCACGAACCCACGAACCTTACGAACCACGAACCTTAACGAACCGAACGAACCAGTCCCCCTGTAAGCACGAACCAACGAACCTACGAACCAACGAACCAGGCACGAACCACGTGACGAACCGGTCACGAACCCACGAACCACGAACCAACGAACCCAGAAACGAACCACGAACCGATACGAACCTATCGACGAACCACGAACCATGTCACGAACCAACGAACCACGAACCACGAACCACACGAACCCGAACGAACCCGTAACGAACCACGAACCGAGTGTAGTACGAACCGACGAACCGACGAACCCCACGAACCTCAACGAACCTGTACGAACCCCGACGAACCACGAACCACGAACCTATAATGGAACGAACCCGACGAACCGCACGAACCACGAACCCCAACGTCAAGCGGTGCTACGAACCTGACGAACCAGCAACGAACCACGAACCCGGACGAACCAACGAACCAACGAACCACGAACCACCTGGACGAACCCCGTACGAACCACGAACCAAACGAACCTGTGGACGAACCCACGAACCACGAACCCAAAACGAACCGTTGACGAACCCGTAACGAACCACGAACCACGAACCTACGAACCTTTTCGTCACGAACCCTCTCTGTTTACGAACCACGAACCTAGACGAACCGATACGAACCCAAATAACGAACCTCCCCCAAGTAGAACGAACCACGAACCTGACGAACCACGAACCGACGTTACGAACCGTCCTAACGAACCTACGAACCATCATCCACGAACCGTCACGAACCTACCGACGAACCAACGAACCATGCAATACGAACCACGAACCTTTCCACGAACCTAATACGAACCTGACGAACCAGACGAACCCGAGACGGTTGGGGCACTTATGTACGAACCATCACGAACCACGAACCTAGCACGAACCGGAGGTAAACGAACCGTCTAGTACGAACCTACGAACCCGCAAACGAACCAGACGAACCTTGAACGAACCAACGAACCGGACGAACCACGAACCTTTGAAGCAACGAACCCTGCTACGAACCAACGAACCACGAACCACGAACCGACACGAACCAGGTTGACGAACCAACGAACCGACGAACCCACGAACCACGAACCTACGACGAACCCGTACGAACCTAACGAACCACGAACCCGGTACGAACCCGCAGCACGAACCACGACGCACGAACCGACGAACCACGAACCGCCTGCGAAACGAACCACGAACCACGAACCTGAGACGAACCTACGAACCACGAACCTACGAACCACGAACCGGACGAACCAACGAACCGACGAACCACTACGAACCGTGCACGAACCCAGGGTTGAGACGAACCAGAACGAACCGGAACGAACCACGAACCATACGAACCTTAACGAACCGACGAACCAATGACGAACCAGCCGCCTCACGAACCTACGAACCTCAACGAACCACGAACCAGGCAACGAACCACGAACCCCTGAACAACGAACCACGAACCACGAACCCACGAACCAACGAACCGTTGTCACGAACCAACGAACCTACGAACCGTCAGACGAACCGTATTGCACGAACCACACGAACCACGAACCGGCACGAACCAACGAACCACGAACCCCTACGAACCACGAACCTCAACGAACCACGAACCGGAACGAACCGAACGAACCACGAACCACGAACCACACGAACCACGAACCACGAACCAACGAACCAACGAACCCGTACTGTGACGAACCACGAACCAACGAACCAAACGAACCGCCACGAACCACCACAACGAACCCCATCGACGAACCACGAACCACGAACCACGAACCAACGAACCGAAACGAACCATGTACGAACCTACGAACCACGAACCTACGAACCCACGAACCACGAACCCACGAACCAGCACGAACCGACGAACCACTTACGAACCTACGAACCACGAACCCACGAACCGACGAACCGTCACGAACCGACGAACCTTACGAACCGGTACGAACCACCACGAACCACGAACCACGAACCCACGAACCATGGCACGAACCCACGAACCCACGAACCTGACACGAACCCCAACGAACCACGACGAACCACGAACCACGAACCTTACGAACCGACGAACCCCGACGAACCACGAACCCACGAACCAACGAACCACGAACCTTCTCGTCCAAACGAACCTTTGACGAACCGTCACGAACCACGAACCTCGCTTCTCTCCTGACGAACCAACGAACCATAACGAACCACGAACCAACGAACCGTACGAACCTCCCAACGAACCCTTGACGAACCCACGAACCTATCTTACTTCCACACGAACCGCTACCAGAACGAACCAACACAACGAACCGACACGAACCGGACGAACCGGATCAACGAACCCGGTTACGAACCACTGTCGACGAACCGGACCGGCCACGAACCAACGAACCAGACGAACCTAGTTCGACGAACCCCAGACGAACCCATCACGAACCACGAACCACGAACCAACGAACCATACGAACCGCCGTGACGAACCAACGAACCATCGCACGAACCCACGAACCAGACGAACCTGCACGAACCACGAACCACGAACCCACGAACCGAGGAATCGTACGAACCACGAACCACGAACCCATCCACGAACCTGGCTCACGAACCACGAACCACCGTTCGACGAACCTGTGGACGAACCATCTGACGAACCACGAACCCACGAACCCGACGAACCCAACGAACCACGAACCACGAACGAACCTACGAACCACGAACCACGAACCACGAACCTTACGAACCCGTACGAACCAACGAACCTTCCTCTTACGAACCGACGAACCAGACACACGAACCACGAACCATACGAACCTCGCAACGAACCTTCCACGAACCACGAACCGACGAACCTTACGAACCAACGAACCACGAACCTGGACGAACCCACGAACCAAACGAACCACGAACCCGACGAACCGACGAACCTATACGAACCCCGAGACGAACCAGCGACGAACCTGGGGACGAACCTACGTGATACAACGTACGAACCACGAACCAGACGAACCAGGGACGAACCACGAACCAACGAACCTACGAACCCGTACGAACCACGAACCGACGAACCTATGACGAACCACGAACCTACGAACCCACCTCCACGAACCACGAACCTACGAACCGAACGAACCGTTACGAACCAATACGAACCCACGAACCACGAACCGAAGACGAACCAACGAACCGAATCACGAACCGGGACGAACCGAGTAACGAACCACGAACCGAGCAATTACGAACCCTGCGAGCGTTCCCAACGAACCCACGAACCACTACGAACCAATACGAACCACGAACC'
pattern = 'ACGAACCAC'
position=[]
for i in range(len(text)-len(pattern)+1):
if text[i:i+len(pattern)] == pattern:
position.append(str(i))
print(' '.join(position))