Advertisement
Spocoman

03. Stream Of Letters

Dec 29th, 2021 (edited)
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. word = ""
  2. secret = "con"
  3. command = input()
  4.  
  5. while command != "End":
  6.     if secret.find(command) != -1:
  7.         secret = secret.replace(command, "")
  8.         if len(secret) == 0:
  9.             print(word, end=" ")
  10.             secret = "con"
  11.             word = ""
  12.     elif command.isalpha():
  13.         word += command
  14.     command = input()
  15.  
  16. Или:
  17.  
  18. secret = 'con'
  19. word = ''
  20. symbol = input()
  21. while symbol != 'End':
  22.     if symbol in secret:
  23.         secret = secret.replace(symbol, '')
  24.         if secret == '':
  25.             secret = 'con'
  26.             print(word, end=' ')
  27.             word = ''
  28.     elif symbol.isalpha():
  29.         word += symbol
  30.     symbol = input()
  31.  
  32. Или:
  33.  
  34. secret = 'con'
  35. string = ''
  36. word = ''
  37. symbol = input()
  38. while symbol != 'End':
  39.     if symbol in secret:
  40.         secret = secret.replace(symbol, '')
  41.         if secret == '':
  42.             secret = 'con'
  43.             string += word + ' '
  44.             word = ''
  45.     elif symbol.isalpha():
  46.         word += symbol
  47.     symbol = input()
  48. print(string)
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement