Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list_words = []
- c = 0
- o = 0
- n = 0
- cc = False
- oo = False
- nn = False
- check_last_word = True
- while True:
- letter = input() # c, o, n срещнат ли се по 1 път се изписва дума,
- if letter == 'End':
- check_last_word = False
- break
- if letter == 'c':
- c += 1
- cc = True
- if c > 1:
- list_words.append(letter)
- elif letter == 'o':
- o += 1
- oo = True
- if o > 1:
- list_words.append(letter)
- elif letter == 'n':
- n += 1
- nn = True
- if n > 1:
- list_words.append(letter)
- else:
- if letter.isalpha():
- list_words.append(letter)
- if cc and oo and nn:
- list_words.append(' ')
- cc = False
- oo = False
- nn = False
- c = 0
- o = 0
- n = 0
- if not check_last_word:
- for y in range(len(list_words) - 1, 0 - 1, -1):
- if list_words[y] != ' ':
- list_words.pop()
- elif list_words[y] == ' ':
- break
- for x in list_words:
- print(x, end='')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement