Farz0l1x

Untitled

Apr 16th, 2023
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. file = open('19.txt')
  2. texts = file.readlines()
  3. Max = 0
  4. Min = 10000000000000
  5. d = dict()
  6. s = ''
  7. s1 = ''
  8. for text in texts:
  9.     s1 += text
  10.     text = text.strip()
  11.     if text.count('Q') > Max:
  12.         Max = text.count('Q')
  13.         s = text
  14. for c in s:
  15.     if c in d:
  16.         d[c] += 1
  17.     else:
  18.         d[c] = 1
  19. minc = ''
  20. for c in d:
  21.     if d[c] < Min or d[c] == Min and c < minc:
  22.         Mun = d[c]
  23.         minc = c
  24. print(minc, s1.count(minc))
Advertisement
Add Comment
Please, Sign In to add comment