Artifact Content
Not logged in

Artifact 127824245ae6e183bb45c64807fc06bb0fde01c4


#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
#ifdef __GNUC__
#include <ext/hash_map>
#define unordered_map __gnu_cxx::hash_map
#else
#include <unordered_map>
#endif
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class PikachuEasy { public:
	string check(string word)
	{
		string zz[] = {"pi", "ka", "chu"};
		while(!word.empty())
		{
			for(int i=0; i<3; ++i)
				if( word.size()>=zz[i].size() && word.substr(0,zz[i].size())==zz[i] ) {
					word = word.substr(zz[i].size());
					goto next;
				}
			return "NO";
		next:;
		}
		return "YES";
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const string& Expected, const string& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, PikachuEasy().check(word));}
int main(){

CASE(0)
	string word = "pikapi"; 
	string _ = "YES"; 
END
CASE(1)
	string word = "pipikachu"; 
	string _ = "YES"; 
END
CASE(2)
	string word = "pikaqiu"; 
	string _ = "NO"; 
END
CASE(3)
	string word = "topcoder"; 
	string _ = "NO"; 
END
CASE(4)
	string word = "piika"; 
	string _ = "NO"; 
END
CASE(5)
	string word = "chupikachupipichu"; 
	string _ = "YES"; 
END
CASE(6)
	string word = "pikapipachu"; 
	string _ = "NO"; 
END
/*
CASE(7)
	string word = ; 
	string _ = ; 
END
CASE(8)
	string word = ; 
	string _ = ; 
END
*/
}
// END CUT HERE