import re S = input() w = 'w' while S and S[0] == w: S = S[1:] reg = re.compile('^[^w]+w+') s = S cands = [] while m := reg.match(s): t = m.group(0) if t[0] != w: cands.append(t) s = s[len(t):] def count_w(s: str) -> int: for i in reversed(range(len(s))): if s[i] != w: return len(s) - i assert False xs = [(s, count_w(s)) for s in cands] _, max_wcnt = max(xs, key=lambda x: x[1]) for s, wcnt in xs: if wcnt == max_wcnt: print(s[:wcnt])