-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path049c.cpp
More file actions
31 lines (30 loc) · 735 Bytes
/
049c.cpp
File metadata and controls
31 lines (30 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
string S;
cin >> S;
reverse(S.begin(),S.end());
size_t point = 0;
while(point < S.size()){
string target = S.substr(point,5);
if(target== "maerd" || target == "esare"){
point += 5;
continue;
}
target = S.substr(point,6);
if(target == "resare"){
point += 6;
continue;
}
target = S.substr(point,7);
if(target == "remaerd"){
point += 7;
continue;
}
break;
}
string ans = (S.size() == point) ?"YES":"NO";
cout << ans << endl;
return 0;
}