よじろめ覚書

私の理解度重視のソースコードです。

ABC017B - choku語

問題:B - choku語

#include <iostream>
#include <string>
using namespace std;

#define REP(i, n) for(int i = 0; i < (n); ++i)

bool isChoku(string x_s) {
    REP(i, x_s.length()) {
        if (x_s[i] == 'o' || x_s[i] == 'k' || x_s[i] == 'u') {
            continue;
        }
        if (i + 1 <= x_s.length() && x_s[i] == 'c' && x_s[i + 1] == 'h') {
            ++i;
            continue;
        }

        return false;
    }

    return true;
}

int main(void){
    string s;

    cin >> s;
    if (isChoku(s)) {
        printf ("YES\n");
    } else {
        printf ("NO\n");
    }

    return 0;
}