dxnge

task 19

Sep 24th, 2021
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. with open('24 (1).txt') as f:
  2.     a = f.readline()
  3.     a = list(map(lambda x: x[2],filter(lambda x: x[0] == x[1], zip(a, a[1:], a[2:]))))
  4. b = ''.join(sorted(a))
  5. b = b.replace('AB', 'A B').replace('BC', 'B C').replace('CD', 'C D').replace('DE', 'D E').replace('EF', 'E F')\
  6.     .replace('FG', 'F G').replace('GH', 'G H').replace('HI', 'H I').replace('IJ', 'I J').replace('JK', 'J K')\
  7.     .replace('KL', 'K L').replace('LM', 'L M').replace('MN', 'M N').replace('NO', 'N O').replace('OP', 'O P')\
  8.     .replace('PQ', 'P Q').replace('QR', 'Q R').replace('RS', 'R S').replace('ST', 'S T').replace('TU', 'T U')\
  9.     .replace('UV', 'U V').replace('VW', 'V W').replace('WX', 'W X').replace('XY', 'X Y').replace('YZ', 'Y Z')
  10.  
  11. symb = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
  12. num = list(map(len, b.split()))
  13.  
  14. print(symb[num.index(max(num))])
Advertisement
Add Comment
Please, Sign In to add comment