HristoBaychev

Untitled

Feb 8th, 2023
820
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. count_c = 0
  2. count_o = 0
  3. count_n = 0
  4. word = ''
  5. new_word = ''
  6.  
  7. command = input()
  8. while command != 'End':
  9.     if 'a' <= command <= 'z' or 'A' <= command <= 'Z':
  10.         if command == 'n' and count_n == 0:
  11.             count_n += 1
  12.         elif command == 'c' and count_c == 0:
  13.             count_c += 1
  14.         elif command == 'o' and count_o == 0:
  15.             count_o += 1
  16.         else:
  17.             word += command
  18.  
  19.         if count_o == 1 and count_c == 1 and count_n == 1:
  20.             new_word = new_word + word + ' '
  21.  
  22.             word = ''
  23.             count_n = 0
  24.             count_o = 0
  25.             count_c = 0
  26.  
  27.     command = input()
  28.  
  29. print(new_word)
Advertisement
Add Comment
Please, Sign In to add comment