Advertisement
juxtapositions

Untitled

Feb 13th, 2022
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. f=open('24-164.txt')
  2. s=f.read()
  3. kt=1
  4. ktmax=0
  5. kmax=0
  6. smax=''
  7. for s in f:
  8.     for i in range(len(s)-1):
  9.         if s[i]==s[i+1]:
  10.             kt+=1
  11.             ktmax=max(ktmax,kt)
  12.         else:
  13.             kt=1
  14.     if ktmax>kmax:
  15.         kmax=ktmax
  16.         smax=s
  17. mas=[0]*26
  18. for i in range(len(smax)-1):
  19.     mas[ord(smax[i])-ord('A')]+=1
  20. kmin=1000000
  21. n=0
  22. for i in range(len(mas)):
  23.     if mas[i]<=kmin and mas[i]!=0:
  24.         kmin=mas[i]
  25.         n=i
  26. ch=chr(n+ord('A'))
  27. k=0
  28. f.close()
  29. f=open('24-164.txt')
  30. for s in f:
  31.     for i in range(len(s)):
  32.         if s[i]==ch:
  33.             k+=1
  34. print(ch,k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement