#include using namespace std; int main() { int i = 0; char x[100]; int state = 0; cin >> x; while((i < 100) && (state < 5)) { if(x[i] == 0) i = 100; else { switch(x[i]) { case 'Y' : state = 1; break; case 'a' : state = state == 1 ? 2 : 0; break; case 'r' : state = state == 2 ? 3 : 0; break; case 'd' : state = state == 3 ? 4 : 0; break; case 'i' : state = state == 4 ? 5 : 0; break; default : state = 0; } i++; } } if(state == 5) cout << "YES"; else cout << "NO"; return 0; }