Submission #2975741


Source Code Expand

#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
	int t;
	cin >> t;
	for(int i = 0; i < t; i++){
			string s;
			cin >> s;
			vector<int> vec;
			for(int j = 0; j + 4 < s.size(); j++){
					if(s.substr(j, 5) == "tokyo" || s.substr(j, 5) == "kyoto"){
							vec.pb(j + 4);
					}
			}
			int res = 0;
			int curr = -1;
			for(auto itr = vec.begin(); itr != vec.end(); ++itr){
					if(curr < (*itr) - 4){
							res++;
							curr = (*itr);
					}
			}
			cout << res << endl;
	}
	return 0;
}

Submission Info

Submission Time
Task A - 東京都
User fumiphys
Language C++ (GCC 5.4.1)
Score 0
Code Size 908 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main(int, const char**)’:
./Main.cpp:37:13: error: ‘itr’ does not name a type
    for(auto itr = vec.begin(); itr != vec.end(); ++itr){
             ^
./Main.cpp:37:32: error: expected ‘;’ before ‘itr’
    for(auto itr = vec.begin(); itr != vec.end(); ++itr){
                                ^
./Main.cpp:37:32: error: ‘itr’ was not declared in this scope