Submission #3908535


Source Code Expand

#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const array<pair<int,int>,4> fd{make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

int main(){
  int t;cin>>t;
  rep(i,t){
    int ans = 0;
    string s;cin>>s;
    int size = s.size();
    rep(j,size-4){
      string sub = s.substr(j,5);
      if(sub == "tokyo" || sub == "kyoto"){
        ans++;
        j += 4;
      }
    }
    cout << ans << endl;
  }
}

Submission Info

Submission Time
Task A - 東京都
User okitz
Language C++14 (GCC 5.4.1)
Score 100
Code Size 627 Byte
Status AC
Exec Time 3 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 3 ms 256 KB
99_teuchi.txt AC 2 ms 256 KB