結果

問題 No.342 一番ワロタww
ユーザー aaaaaaiu
提出日時 2019-08-14 22:50:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 5,000 ms
コード長 823 bytes
コンパイル時間 2,046 ms
コンパイル使用メモリ 199,500 KB
最終ジャッジ日時 2025-01-07 11:49:26
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    string s;
    cin>>s;
    if (s=="0w") {
        cout<<0<<endl;
        return 0;
    }
    int n=s.size();
    vector<string> ss;
    vector<int> w;
    int i=0;
    while (s.substr(i,3)=="w") i+=3;
    while (i<n) {
        string t;
        while (i<n&&s.substr(i,3)!="w") {
            t+=s.substr(i,3);
            i+=3;
        }
        ss.push_back(t);
        int cnt=0;
        while (i<n&&s.substr(i,3)=="w") {
            cnt++;
            i+=3;
        }
        w.push_back(cnt);
    }
    int mx=0;
    for (int x:w) mx=max(mx,x);
    if (mx==0) {
        cout<<endl;
        return 0;
    }
    for (int i=0;i<w.size();i++) {
        if (w[i]==mx) {
            cout<<ss[i]<<endl;
        }
    }
    return 0;
}
0