#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+5;
char a[maxn];

int main(){
	int len,f;
	while(scanf("%s",a)==1){
		len=strlen(a);
		f = 0;int k = 0;
		for(int i=len-1;i>=0;i-=k){
			if(a[i]=='r'){
				if(a[i-1]=='e'&&a[i-2]=='s'&&a[i-3]=='a'&&a[i-4]=='r'&&a[i-5]=='e'&&i>=0)
					k = 6;
				else if(a[i-1]=='e'&&a[i-2]=='m'&&a[i-3]=='a'&&a[i-4]=='e'&&a[i-5]=='r'&&a[i-6]=='d'&&i>=0)
					k = 7;
				else{
					f = 1;
					break;
				}
			}
			if(a[i]=='m'){
				if(a[i-1]=='a'&&a[i-2]=='e'&&a[i-3]=='r'&&a[i-4]=='d'&&i>=0)
					k = 5;
				else{
					f = 1;
					break;
				}
			}
			if(a[i]=='e'){
				if(a[i-1]=='s'&&a[i-2]=='a'&&a[i-3]=='r'&&a[i-4]=='e'&&i>=0)
					k = 5;
				else{
					f = 1;
					break;
				}
			}		
		}
		if(f==1)
			printf("NO\n");
		else
			printf("YES\n");
	}
	return 0;
}