Submission #2214799


Source Code Expand

#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PI;
typedef pair<LL, LL> PLL;
const LL MOD = 1000000007LL;
const int inf = 1e9;
const LL INF = 1e18;
int main() {
	int T;
	cin >> T;
	for (int t = 0; t < T; t++) {
		string S;
		cin >> S;
		int pos = 0;
		int ans = 0;
		while (pos + 5 <= S.size()) {
			string s = S.substr(pos, 5);
			if (s == "tokyo" || s == "kyoto") {
				pos += 5;
				ans++;
			}
			else {
				pos++;
			}
		}
		cout << ans << endl;
	}
}

Submission Info

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