-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathC.cpp
77 lines (76 loc) · 1.49 KB
/
C.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Online C++ compiler to run C++ program online
#include <bits/stdc++.h>
using namespace std;
int main() {
// Write C++ code here
int i,p=0,f=0,n;
string s,t;
cin>>s;
n=s.size();
reverse(s.begin(),s.end());
while(f!=n)
{
//cout<<f<<"\n";
if(s[f]=='r')
{
if(f+6<=n)
{
t=s.substr(f,6);
if(t=="resare")
{
f=f+6;
continue;
}
}
if(f+7<=n)
{
t=s.substr(f,7);
if(t=="remaerd")
{
f=f+7;
continue;
}
}
p=1;
break;
}
else if(s[f]=='e')
{
if(f+5<=n)
{
t=s.substr(f,5);
if(t=="esare")
{
f=f+5;
continue;
}
}
p=1;
break;
}
else if(s[f]=='m')
{
if(f+5<=n)
{
t=s.substr(f,5);
if(t=="maerd")
{
f=f+5;
continue;
}
}
p=1;
break;
}
else
{
p=1;
break;
}
}
if(p==1)
cout<<"NO"<<"\n";
else
cout<<"YES"<<"\n";
return 0;
}