Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2022
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.18 KB | None | 0 0
  1. symbols = ["A", "a", "B", "b", "D", "d", "E", "e", "F", "f", "G", "g", "H", "h", "I", "i", "J", "j", "K", "k",
  2.            "L", "l", "M", "m", "P", "p", "Q", "q", "R", "r", "S", "s", "T", "t", "U", "u", "V", "v", "W", "w",
  3.            "X", "x", "Y", "y", "Z", "z", "C", "N", "O"]
  4.  
  5. count_c = 0
  6. count_o = 0
  7. count_n = 0
  8.  
  9. text = ""
  10. result = ""
  11.  
  12. while True:
  13.     symbol = input()
  14.     if symbol != "End":
  15.  
  16.         if symbol == "c":
  17.             if count_c != 1:
  18.                 count_c += 1
  19.             else:
  20.                 text += symbol
  21.  
  22.         elif symbol == "o":
  23.             if count_o != 1:
  24.                 count_o += 1
  25.             else:
  26.                 text += symbol
  27.  
  28.         elif symbol == "n":
  29.             if count_n != 1:
  30.                 count_n += 1
  31.             else:
  32.                 text += symbol
  33.  
  34.         else:
  35.             if symbol in symbols:
  36.                 text += symbol
  37.             else:
  38.                 continue
  39.         if count_c + count_o + count_n == 3:
  40.             result += text + " "
  41.             text = ""
  42.             count_c = 0
  43.             count_o = 0
  44.             count_n = 0
  45.  
  46.     else:  # symbol == "End":
  47.         print(result)
  48.         break
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement