Submission #533069


Source Code Expand

#include <iostream>
#include <string>
using namespace std;
int main(){
	int T;
	cin >> T;
	for(int k=0;k<T;k++){
		string s;
		cin >> s;
		string to="tokyo";
		string ky="kyoto";
		int ans=0;
		for(int i=0;i<s.size()-4;i++){
			int j=0;
			for(;j<5;j++){
				if(to[j]!=s[i+j])
					break;
			}
			if(j==5){
				ans++;
				i+=4;
				continue;
			}
			j=0;
			for(;j<5;j++){
				if(ky[j]!=s[i+j])
					break;
			}
			if(j==5){
				ans++;
				i+=4;
			}
		}
		cout << ans <<endl;
	}
	return 0;
}

Submission Info

Submission Time
Task A - 東京都
User base64
Language C++ (GCC 4.9.2)
Score 0
Code Size 528 Byte
Status RE
Exec Time 695 ms
Memory 920 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 2
RE × 1
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 28 ms 920 KB
20_noised_tokyoto.txt AC 28 ms 800 KB
99_teuchi.txt RE 695 ms 808 KB