Farz0l1x

Untitled

Nov 17th, 2023
941
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. Max = 0
  2. for n in range(4, 1000):
  3.     s = '1' + n * '2'
  4.     while '12' in s or '322' in s or '222' in s:
  5.         if '12' in s:
  6.             s = s.replace('12', '2', 1)
  7.         if '322' in s:
  8.             s = s.replace('322', '21', 1)
  9.         if '222' in s:
  10.             s = s.replace('222', '3', 1)
  11.     Max = max(Max, len(s))
  12. print(Max)
Advertisement
Add Comment
Please, Sign In to add comment