# -*- coding: utf-8 -*- from collections import defaultdict s = input() #print(s) L = len(s) #print("L", L) mp = defaultdict(list) count = 0 t = "" w = 'w' last = '' for i in reversed(range(L)): #print(i) c = s[i] #print(c) 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 #print("count", count) if(t!=""): mp[count].append(t) # print(mp) keys = list(mp.keys()) ma = keys[-1] # print(ma) texts = mp[ma] for s in reversed(texts): print(s)