Submission #1982973


Source Code Expand

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

#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for ( int i = 0 ; i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1e18;

signed main() {
  int t;
  cin >> t;
  Rep(i, t) {
    string s;
    cin >> s;
    int ans = 0;
    Rep(j, s.size()-4) {
      if ( j+4 >= s.size() ) break;
      if ( s.substr(j, 5) == "tokyo" ) {
	ans++;
	j += 4;
	continue;
      }
      if ( j+4 >= s.size() ) break;
      if ( s.substr(j, 5) == "kyoto" ) {
	ans++;
	j += 4;
	continue;
      }					
    }

    cout << ans << endl;
  }
}

Submission Info

Submission Time
Task A - 東京都
User shot
Language C++14 (GCC 5.4.1)
Score 100
Code Size 764 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