結果

問題 No.536 人工知能
ユーザー kichirb3
提出日時 2018-02-26 21:44:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 460 bytes
コンパイル時間 4,493 ms
コンパイル使用メモリ 215,812 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-24 21:12:18
合計ジャッジ時間 5,269 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

// No.536 人工知能
// https://yukicoder.me/problems/no/536
//

#include <iostream>
#include <regex>
using namespace std;

string solve(string &S);


int main() {
    string S;
    cin >> S;
    string ans = solve(S);
    cout << ans << endl;
}

string solve(string &S) {
    regex rx(R"(ai$)");
    string rep = "AI";
    smatch m;

    if (regex_search(S, m, rx)) {
        return regex_replace(S, rx, rep);
    } else {
        return S + "-AI";
    }
}
0