Advertisement
HristoBaychev

Stream Of Letters

Feb 8th, 2023
842
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. import string
  2.  
  3. main_string = string.ascii_letters
  4. first_word = ''
  5. final_string = ''
  6.  
  7. c_counter = 0
  8. o_counter = 0
  9. n_counter = 0
  10.  
  11. end = 'End'
  12.  
  13. while end == "End":
  14.     if c_counter >= 1 and o_counter >= 1 and n_counter >= 1:
  15.         first_word += ' '
  16.         final_string += first_word
  17.         first_word = ''
  18.         c_counter = 0
  19.         o_counter = 0
  20.         n_counter = 0
  21.         letter_count = 0
  22.  
  23.     letter = input()
  24.  
  25.     if letter == "End":
  26.         break
  27.  
  28.     if letter == 'c':
  29.         c_counter += 1
  30.  
  31.         if c_counter > 1:
  32.             first_word += letter
  33.         continue
  34.  
  35.     if letter == 'o':
  36.         o_counter += 1
  37.  
  38.         if o_counter > 1:
  39.             first_word += letter
  40.         continue
  41.  
  42.     if letter == 'n':
  43.         n_counter += 1
  44.  
  45.         if n_counter > 1:
  46.             first_word += letter
  47.         continue
  48.  
  49.     if letter in main_string:
  50.         first_word += letter
  51.  
  52. print(final_string)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement