#include using namespace std; struct uns_t {} uns; template auto vec(Element init, Head arg, Args ...args) { if constexpr (sizeof...(Args) == 0) return std::vector(arg, init); else return std::vector(arg, vec(init, args...)); } template auto vec(uns_t, Head arg, Args ...args) { return vec(Element(), arg, args...); } int main() { string suf[CHAR_MAX + 1]; suf['k'] = "adomatsu"; suf['a'] = "domatsu"; suf['d'] = "omatsu"; suf['o'] = "matsu"; suf['m'] = "atsu"; suf[0] = "tsu"; suf['t'] = "su"; suf['s'] = "u"; suf['u'] = ""; string s; cin >> s; bool ans = true, found = false; for (int i = 0; i < s.size(); ++i) { auto c = suf[s[i]]; if (s[i] == 'a' && found) { c = suf[0]; } for (int j = i + 1; j < s.size(); ++j) { ans &= !!count(begin(c), end(c), s[j]); } found |= s[i] == 'a'; } int cnt[CHAR_MAX + 1] = {}; cnt['k'] += 1; cnt['a'] += 1; cnt['d'] += 1; cnt['o'] += 1; cnt['m'] += 1; cnt['a'] += 1; cnt['t'] += 1; cnt['s'] += 1; cnt['u'] += 1; for (auto c : s) --cnt[c]; for (auto e : cnt) { ans &= 0 <= e; } cout << (ans && count(begin(s), end(s), 'a') <= 2 ? "Yes" : "No") << endl; }