Submission #532958


Source Code Expand

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999
#define eps 1e-9

int main(){
    string s;
    int n;
    cin>>n;
    rep(i,n){
        cin>>s;
        int c=0;
        for(int i=0;i<(int)s.size()-4;){
            if(s.substr(i,5)=="tokyo"||s.substr(i,5)=="kyoto"){
                c++;
                i+=5;
            }
            else i++;
        }
        cout<<c<<endl;
    }
}

    
    
    
    
    
    

Submission Info

Submission Time
Task A - 東京都
User Yazaten
Language C++ (GCC 4.9.2)
Score 100
Code Size 621 Byte
Status AC
Exec Time 29 ms
Memory 928 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 29 ms 920 KB
20_noised_tokyoto.txt AC 27 ms 928 KB
99_teuchi.txt AC 27 ms 924 KB