Submission #532928


Source Code Expand

#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

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

    while(--t >= 0){
        string s;
        cin >> s;
        int n = s.size();

        int i = 0;
        int ans = 0;
        while(i + 5 <= n){
            string t = s.substr(i, 5);
            if(t == "tokyo" || t == "kyoto"){
                ++ ans;
                i += 5;
            }
            else{
                ++ i;
            }
        }
        cout << ans << endl;
    }

    return 0;
}

Submission Info

Submission Time
Task A - 東京都
User mamekin
Language C++11 (GCC 4.9.2)
Score 100
Code Size 885 Byte
Status AC
Exec Time 26 ms
Memory 924 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 26 ms 924 KB
20_noised_tokyoto.txt AC 25 ms 800 KB
99_teuchi.txt AC 25 ms 924 KB