Skip to content

Instantly share code, notes, and snippets.

@nukopy
Created January 4, 2019 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nukopy/34d26b448e06e9c58bed89e7145ad86a to your computer and use it in GitHub Desktop.
Save nukopy/34d26b448e06e9c58bed89e7145ad86a to your computer and use it in GitHub Desktop.
ABC017: B - choku語
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator> // std::back_inserter()
#include <set>
#include <map>
#include <algorithm> // std::copy()
#include <functional> // std::greater<T>()
#include <utility> // std::swap()
#include <numeric> // accumulate(ALL(vec), 0) 0 は初期値
#include <cmath>
#include <climits> // INT_MIN
#include <cctype> // std::isdigit()
#include <iomanip> // std::setprecision()
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++) // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++) // 1 ~ n
#define MIN(vec) min_element(ALL((vec))) // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0) // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2)) // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;
const int MOD = 1000000007; // 1 000 000 007
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
// input
string X;
cin >> X;
// calculation
char choku;
REP(i, X.length()) {
choku = X[i];
if (choku == 'c' || choku == 'h' || choku == 'o' || choku == 'k' || choku == 'u') {
if (choku == 'c') {
if (i != X.length()-1) {
if (X[i+1] == 'h') {
continue;
} else {
cout << "NO" << "\n";
return 0;
}
} else {
cout << "NO" << "\n";
return 0;
}
} else if (choku == 'h') {
if (i != 0) {
if (X[i-1] == 'c') {
continue;
} else {
cout << "NO" << "\n";
return 0;
}
} else {
cout << "NO" << "\n";
return 0;
}
} else {
continue;
}
} else {
cout << "NO" << "\n";
return 0;
}
}
cout << "YES" << "\n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment