# -*- coding: utf-8 -*- from collections import defaultdict s = input() L = len(s) # X文字の文字列のリストを管理 mp = defaultdict(list) count = 0 t = "" w = 'w' last = '' for i in reversed(range(L)): c = s[i] if c==w: if last==w: count += 1 else: # register mp[count].append(t) t = "" count = 1 # 文字 else: if last=='': continue else: t = c + t last = c if(t!=""): mp[count].append(t) if len(mp)==0: exit(0) keys = sorted(list(mp.keys())) ma = keys[-1] texts = mp[ma] for s in reversed(texts): print(s)