Submission #2666956
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) int main(){ int t; cin >> t; string s[t]; rep(i,t)cin >> s[i]; rep(i,t){ int ct = 0; rep(j,(int)s[i].size()-4){ string check = s.substr(i,5); if((check == "kyoto"||check == "tokyo"){ ct++; j+=4; } } cout << ct << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | tubotu |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 466 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:13:30: error: request for member ‘substr’ in ‘s’, which is of non-class type ‘std::string [t] {aka std::basic_string<char> [t]}’ string check = s.substr(i,5); ^ ./Main.cpp:14:52: error: expected ‘)’ before ‘{’ token if((check == "kyoto"||check == "tokyo"){ ^ ./Main.cpp:18:9: error: expected primary-expression before ‘}’ token } ^