Submission #1983239


Source Code Expand

#include<iostream>
#include<string>
using namespace std;

int main()
{
  int n;
  cin >> n;

  string S;
  for(int i = 0; i < n; i++){
    int cnt = 0;
    cin >> S;
    if(S.size() < 5){
      cout << '0' << endl;
      continue;
    }

    for(int j = 0; j <= S.size() - 5; j++){
      if(S.substr(j, 5) == "kyoto"){
        cnt++;
        j += 4;
    }
      if(S.substr(j, 5) == "tokyo"){
        cnt++;
        j += 4;
      }
    }

    cout << cnt << endl;
  }

  return 0;

}

Submission Info

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