以下の内容はhttps://blog.hamayanhamayan.com/entry/2020/03/09/001729より取得しました。


Hitachi String [Social Infrastructure Information Systems Division, Hitachi Programming Contest 2020 A]

https://atcoder.jp/contests/hitachi2020/tasks/hitachi2020_a

解説

https://atcoder.jp/contests/hitachi2020/submissions/10690930

まず、文字列長が奇数であれば、hitachi文字列にはなりえない。
偶数であれば、2つずつ文字列を区切って、hiかどうかを確かめていけばいい。

string S;
//---------------------------------------------------------------------------------------------------
#define yes "Yes"
#define no "No"
string solve() {
    int n = S.length();

    if (n % 2 == 1) return no;
    rep(i, 0, n / 2) if (S.substr(i * 2, 2) != "hi") return no;

    return yes;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> S;
    cout << solve() << endl;
}



以上の内容はhttps://blog.hamayanhamayan.com/entry/2020/03/09/001729より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14