Submission #532953


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

string tokyo = "tokyo";
string kyoto = "kyoto";

int main(){


  int T;
  cin>>T;
  while(T--){
    string s;
    cin>>s;
    int res = 0;
    for(int i=0;i<(int)s.size();i++){
      if(s.substr(i, tokyo.size()) == tokyo){
        i += tokyo.size();
        i--;
        res++;
      }
      else if(s.substr(i, kyoto.size()) == kyoto){
        i += kyoto.size();
        i--;
        res++;
      }
    }
    cout<<res<<endl;
  }

  return 0;
}

Submission Info

Submission Time
Task A - 東京都
User ishikado
Language C++11 (GCC 4.9.2)
Score 100
Code Size 527 Byte
Status AC
Exec Time 29 ms
Memory 912 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 912 KB
20_noised_tokyoto.txt AC 28 ms 756 KB
99_teuchi.txt AC 26 ms 804 KB