Submission #1726658


Source Code Expand

#include <iostream>
using namespace std;

int main() {
    int T;
    cin >> T;

    for (int i = 0; i < T; i++) {
        string S;
        cin >> S;

        // "tokyo"
        int ans = 0;
        int idx = S.size() - 1;
        while (idx >= 0) {
            string s = S.substr(idx, 5);
            if (s == "kyoto" or s == "tokyo") {
                ans++;
                idx -= 5;
            } else {
                idx--;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task A - 東京都
User myusa
Language C++14 (GCC 5.4.1)
Score 100
Code Size 533 Byte
Status AC
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 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 AC 2 ms 256 KB
20_noised_tokyoto.txt AC 2 ms 256 KB
99_teuchi.txt AC 2 ms 256 KB