Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. end_command = "End"
  2. word = ""
  3. text = ""
  4. count_c = 0
  5. count_o = 0
  6. count_n = 0
  7. while True:
  8. character = str(input())
  9. if character == end_command:
  10. print(f"{text}")
  11. break
  12.  
  13. if character != "n" and character != "c" and character != "o" :
  14. if (ord(character) in range(ord("a"), ord("z"))) or (ord(character) in range(ord("A"), ord("Z"))):
  15. word += character
  16. if count_c == 1 and character == "c":
  17. word += character
  18. if count_o == 1 and character == "o":
  19. word += character
  20. if count_n == 1 and character == "n":
  21. word += character
  22. if character == "c":
  23. count_c = 1
  24. if character == "o":
  25. count_o = 1
  26. if character == "n":
  27. count_n = 1
  28.  
  29. if count_c == 1 and count_n == 1 and count_o == 1:
  30. text += word + " "
  31. word = ""
  32. count_c = 0
  33. count_n = 0
  34. count_o = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement