Nikolay9

Stream of Letters

Oct 18th, 2022 (edited)
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. import string
  2. text1 = ""
  3. text2 = ""
  4. command = ""
  5. while True:
  6.     command = input()
  7.     if command == "End":
  8.         break
  9.     if command not in string.ascii_letters:
  10.         continue
  11.     if (command == "c" and "c" not in text2) or (command == "n" and "n" not in text2) or (command == "o" and "o" not in text2):
  12.         text2 += command
  13.     else:
  14.         text1 += command
  15.     if "c" in text2 and "n" in text2 and "o" in text2:
  16.         text1 += " "
  17.         print(text1, end="")
  18.         text1 = ""
  19.         text2 = ""
Advertisement
Add Comment
Please, Sign In to add comment