#include #define REP(i,n) for(int i=0;i<(int)(n);i++) #define ALL(x) (x).begin(),(x).end() using namespace std; vector utf8(string str) { vector res; int n = 0; for (int i = 0; i < (int)str.size(); i += n) { n = 1; unsigned char c = str[i]; n += (c >= 0x80); n += (c >= 0xE0); n += (c >= 0xF0); res.push_back(str.substr(i, n)); } return res; } int main() { string str; cin >> str; str += "あ"; int n = 0, ma = 0; vector res; string s; for (string c: utf8(str)) { if (c == "w") ++n; else { if (n > 0 && !s.empty()) { if (n > ma) { ma = n; res = {s}; } else if (n == ma) res.push_back(s); s = ""; } n = 0; s += c; } } for (auto s: res) cout << s << endl; return 0; }