結果

問題 No.1643 Not Substring
ユーザー srjywrdnprkt
提出日時 2023-06-08 00:09:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 705 bytes
コンパイル時間 844 ms
コンパイル使用メモリ 107,868 KB
最終ジャッジ日時 2025-02-13 23:20:33
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

vector<pair<char, long long>> encoded;

void encode(string &S){
    long long l = 0, r, N=S.size();
    while(l != N){
        r = l+1;
        while(r<N && S[l] == S[r]) r++;
        encoded.push_back(make_pair(S[l], r-l));
        l = r;
    }
}

int main(){

    string S;
    cin >> S;
    encode(S);
    int mx=0;
    for (auto [x, y] : encoded) if (x == 'a') mx = max(mx, (int)y);

    cout << string(mx+1, 'a') << endl;

    return 0;
}
0