Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open('textik4.txt','r')
- count = 0
- l = 0
- max = 0
- alstat = [0]*31
- words = []
- stat = [0]*31
- alph = "AБВГДЕЖЗИКЛМНОПРСТУФХЦЧШЩЫЬЭЮЯ_"
- text = f.read()
- words = set(text)
- n = len(text)
- k = len(words)
- print("Kolvo vceh cimvolov in text:",n,"Kolvo vceh razn bukv:",k)
- words = list(words)
- la = list(text)
- text = list(text)
- for i in range(1,40):
- for j in range(0,n-i-1):
- if text[j] == text[j+i]:
- count += 1
- if count > max:
- max = count
- k = i
- count = 0
- print(k)
- nooptext = [0]*len(text)
- key = ""
- for i in range(0,k):
- for j in range(l,len(text)-k,k):
- alstat[alph.index(text[j])] += 1
- print(alph.index(text[j]))
- max = 0
- for j in range(len(alstat)):
- if alstat[j] > max:
- max = alstat[j]
- id_max = j
- key += alph[(id_max+1) % len(alph)]
- id_max = 30 - id_max
- j = 1
- for j in range(l,len(text)-k,k):
- nooptext[j] = alph[(alph.index(text[j]) + id_max) % len(alph)]
- l += 1
- alstat = [0]*31
- f.close()
- """f = open('open_text.txt','w+')
- f.write(nooptext)
- f.close()"""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement