Submission #532934


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

int main(){
  string str;
  int T;
  cin>>T;
  while(T--){
    cin>>str;
    int ans=0;
    for(int i=0;i+4<(int)str.size();i++){
      if(str.substr(i,5) == "tokyo"){
        for(int j=i;j<i+5;j++)str[j]='.';
        ans++;
      }else if(str.substr(i,5) == "kyoto"){
        for(int j=i;j<i+5;j++)str[j]='.';
        ans++;
      }      
    }
    cout<<ans<<endl;
  }
  return 0;
}

Submission Info

Submission Time
Task A - 東京都
User dohatsutsu
Language C++ (GCC 4.9.2)
Score 100
Code Size 454 Byte
Status AC
Exec Time 35 ms
Memory 1056 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 34 ms 1056 KB
20_noised_tokyoto.txt AC 35 ms 980 KB
99_teuchi.txt AC 31 ms 984 KB