Advertisement
sykg

Untitled

Oct 25th, 2018
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. def two_lengt_run(list):
  2. i = 0
  3. p = []
  4. g = 0
  5. a = False
  6. length = len(list)
  7. while i in range(0,length):
  8.  
  9.  
  10.  
  11. if int(list[i]) == int(list[i+1]):
  12. a = True
  13. g = g + 1
  14. elif int(list[i]) != int(list[i+1]):
  15. a = False
  16.  
  17. if a == False:
  18. p.append(g + 1)
  19. g = 0
  20.  
  21. if i != length:
  22. break
  23.  
  24. i = i + 1
  25.  
  26. print(max(p))
  27.  
  28. list = input('Enter a list of characters separated ').strip().split(" ")
  29. two_lengt_run(list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement