Advertisement
Aikiro42

engg_strings

Feb 14th, 2020
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. def is_engg_string(string):
  2.     if len(string) >= 4:
  3.         if string[0] in 'eE' and string[1] == 'N':
  4.             temp_str = string[1:]
  5.             while len(temp_str) > 0:
  6.                 if temp_str[0] == 'N':
  7.                     temp_str = temp_str[1:]
  8.                 else:
  9.                     break
  10.             if temp_str == 'GG':
  11.                 return True
  12.             else:
  13.                 return is_engg_string(temp_str)
  14.         else:
  15.             return False
  16.     else:
  17.         return False
  18.  
  19. n = int(input())
  20. cases = [input() for _ in range(n)]
  21. solved_cases = [is_engg_string(case) for case in cases]
  22.  
  23. is_lowercase = True
  24.  
  25. if is_lowercase:
  26.     [print(str(case).lower()) for case in solved_cases]
  27. else:
  28.     [print(case) for case in solved_cases]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement