Submission #3835981


Source Code Expand

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
using namespace std;

int T;
string S[100];

int main() {
    cin >> T;
    rep(i, T)   cin >> S[i];
    rep(i, T) {
        string s(S[i]);
        size_t kp = s.find("kyoto");
        size_t tp = s.find("tokyo");
        int res = 0;

        while( kp != string::npos or kp != string::npos ) {
            (kp < tp) ? s.erase(kp, 5) : s.erase(tp, 5);
            res++;
            kp = s.find("kyoto");
            tp = s.find("tokyo");
        }
        cout << res << endl;
    }
}

Submission Info

Submission Time
Task A - 東京都
User ren_amaike
Language C++14 (GCC 5.4.1)
Score 0
Code Size 638 Byte
Status WA
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
WA × 3
Set Name Test Cases
All 10_random_to_kyo.txt, 20_noised_tokyoto.txt, 99_teuchi.txt
Case Name Status Exec Time Memory
10_random_to_kyo.txt WA 2 ms 256 KB
20_noised_tokyoto.txt WA 2 ms 256 KB
99_teuchi.txt WA 2 ms 256 KB