Submission #2696382


Source Code Expand

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

int main(void){
    int T; cin >> T;
    string s[101];
    for(int i = 0; i < T; i++) cin >> s[i];

    string str[2] = {"tokyo", "kyoto"};

    for(int i = 0; i < T; i++){
        int res = 0;
        for(int j = 0; j < (int)s[i].size(); j++){
            for(int k = 0; k < 2; k++){
                for(int l = 0; l < 5; l++){
                    if(s[i][j+l]!=str[k][l]) break;
                    if(l == 4){
                        res++;
                        j += 4;
                    }
                }
            }
        }

        cout << res << '\n';
    }

    return 0;
}

Submission Info

Submission Time
Task A - 東京都
User yna87
Language C++14 (GCC 5.4.1)
Score 100
Code Size 684 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 1 ms 256 KB