S = input()[::-1] cnt = 0 moji = "" ans = {} for s in S: if s == "w": if cnt and moji: if cnt not in ans: ans[cnt] = [moji[::-1]] else: ans[cnt].append(moji[::-1]) moji = "" cnt = 0 cnt += 1 else: if not cnt and not moji: continue moji += s if moji: if cnt not in ans: ans[cnt] = [moji[::-1]] else: ans[cnt].append(moji[::-1]) try: for a in ans[max(ans.keys())][::-1]: print(a) except ValueError: print("")