
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String a=sc.next();
		int[] DREAMS=new int[6];
		for(int i=0; i<6; i++) {
			DREAMS[i]=0;
		}

		for(int i=0; i<a.length(); i++) {
			if(a.charAt(i)=='d') {
				DREAMS[0]++;
			}
			else if(a.charAt(i)=='r') {
				DREAMS[1]++;
			}
			else if(a.charAt(i)=='e') {
				DREAMS[2]++;
			}
			else if(a.charAt(i)=='a') {
				DREAMS[3]++;
			}
			else if(a.charAt(i)=='m') {
				DREAMS[4]++;
			}
			else if(a.charAt(i)=='s') {
				DREAMS[5]++;
			}
		}

		int x=0,y=0,z=0,w=0;

		x=2*DREAMS[3]-DREAMS[2];
		y=DREAMS[2]-DREAMS[5]*2-DREAMS[4];
		z=DREAMS[1]+DREAMS[5]-DREAMS[2];
		w=DREAMS[2]-DREAMS[1];

		//System.out.println(x+" "+y+" "+z+" "+w);

		if(a.length()==x*5+y*7+6*z+5*w) {
			if(x+y==DREAMS[0]) {
				if(x+2*y+2*z+w==DREAMS[1]) {
					if(x+2*y+z*2+w*2==DREAMS[2]) {
						if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		System.out.println("NO");
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String a=sc.next();
		int[] DREAMS=new int[6];
		for(int i=0; i<6; i++) {
			DREAMS[i]=0;
		}

		for(int i=0; i<a.length(); i++) {
			if(a.charAt(i)=='d') {
				DREAMS[0]++;
			}
			else if(a.charAt(i)=='r') {
				DREAMS[1]++;
			}
			else if(a.charAt(i)=='e') {
				DREAMS[2]++;
			}
			else if(a.charAt(i)=='a') {
				DREAMS[3]++;
			}
			else if(a.charAt(i)=='m') {
				DREAMS[4]++;
			}
			else if(a.charAt(i)=='s') {
				DREAMS[5]++;
			}
		}

		int x=0,y=0,z=0,w=0;

		x=2*DREAMS[3]-DREAMS[2];
		y=DREAMS[2]-DREAMS[5]*2-DREAMS[4];
		z=DREAMS[1]+DREAMS[5]-DREAMS[2];
		w=DREAMS[2]-DREAMS[1];

		//System.out.println(x+" "+y+" "+z+" "+w);

		if(a.length()==x*5+y*7+6*z+5*w) {
			if(x+y==DREAMS[0]) {
				if(x+2*y+2*z+w==DREAMS[1]) {
					if(x+2*y+z*2+w*2==DREAMS[2]) {
						if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		System.out.println("NO");
	}
} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String a=sc.next();
		int[] DREAMS=new int[6];
		for(int i=0; i<6; i++) {
			DREAMS[i]=0;
		}

		for(int i=0; i<a.length(); i++) {
			if(a.charAt(i)=='d') {
				DREAMS[0]++;
			}
			else if(a.charAt(i)=='r') {
				DREAMS[1]++;
			}
			else if(a.charAt(i)=='e') {
				DREAMS[2]++;
			}
			else if(a.charAt(i)=='a') {
				DREAMS[3]++;
			}
			else if(a.charAt(i)=='m') {
				DREAMS[4]++;
			}
			else if(a.charAt(i)=='s') {
				DREAMS[5]++;
			}
		}

		int x=0,y=0,z=0,w=0;

		x=2*DREAMS[3]-DREAMS[2];
		y=DREAMS[2]-DREAMS[5]*2-DREAMS[4];
		z=DREAMS[1]+DREAMS[5]-DREAMS[2];
		w=DREAMS[2]-DREAMS[1];

		//System.out.println(x+" "+y+" "+z+" "+w);

		if(a.length()==x*5+y*7+6*z+5*w) {
			if(x+y==DREAMS[0]) {
				if(x+2*y+2*z+w==DREAMS[1]) {
					if(x+2*y+z*2+w*2==DREAMS[2]) {
						if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		System.out.println("NO");
	} main {
		Scanner sc=new Scanner(System.in);
		String a=sc.next();
		int[] DREAMS=new int[6];
		for(int i=0; i<6; i++) {
			DREAMS[i]=0;
		}

		for(int i=0; i<a.length(); i++) {
			if(a.charAt(i)=='d') {
				DREAMS[0]++;
			}
			else if(a.charAt(i)=='r') {
				DREAMS[1]++;
			}
			else if(a.charAt(i)=='e') {
				DREAMS[2]++;
			}
			else if(a.charAt(i)=='a') {
				DREAMS[3]++;
			}
			else if(a.charAt(i)=='m') {
				DREAMS[4]++;
			}
			else if(a.charAt(i)=='s') {
				DREAMS[5]++;
			}
		}

		int x=0,y=0,z=0,w=0;

		x=2*DREAMS[3]-DREAMS[2];
		y=DREAMS[2]-DREAMS[5]*2-DREAMS[4];
		z=DREAMS[1]+DREAMS[5]-DREAMS[2];
		w=DREAMS[2]-DREAMS[1];

		//System.out.println(x+" "+y+" "+z+" "+w);

		if(a.length()==x*5+y*7+6*z+5*w) {
			if(x+y==DREAMS[0]) {
				if(x+2*y+2*z+w==DREAMS[1]) {
					if(x+2*y+z*2+w*2==DREAMS[2]) {
						if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		System.out.println("NO");
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String a=sc.next(); a sc.next() sc.next sc int[] DREAMS=new int[6]; DREAMS new int[6] 6 for(int i=0; i<6; i++) {
			DREAMS[i]=0;
		} int i=0; int i=0; i 0 i<6 i 6 i++ i++ i {
			DREAMS[i]=0;
		} {
			DREAMS[i]=0;
		} DREAMS[i]=0 DREAMS[i] DREAMS i 0 for(int i=0; i<a.length(); i++) {
			if(a.charAt(i)=='d') {
				DREAMS[0]++;
			}
			else if(a.charAt(i)=='r') {
				DREAMS[1]++;
			}
			else if(a.charAt(i)=='e') {
				DREAMS[2]++;
			}
			else if(a.charAt(i)=='a') {
				DREAMS[3]++;
			}
			else if(a.charAt(i)=='m') {
				DREAMS[4]++;
			}
			else if(a.charAt(i)=='s') {
				DREAMS[5]++;
			}
		} int i=0; int i=0; i 0 i<a.length() i a.length() a.length a i++ i++ i {
			if(a.charAt(i)=='d') {
				DREAMS[0]++;
			}
			else if(a.charAt(i)=='r') {
				DREAMS[1]++;
			}
			else if(a.charAt(i)=='e') {
				DREAMS[2]++;
			}
			else if(a.charAt(i)=='a') {
				DREAMS[3]++;
			}
			else if(a.charAt(i)=='m') {
				DREAMS[4]++;
			}
			else if(a.charAt(i)=='s') {
				DREAMS[5]++;
			}
		} {
			if(a.charAt(i)=='d') {
				DREAMS[0]++;
			}
			else if(a.charAt(i)=='r') {
				DREAMS[1]++;
			}
			else if(a.charAt(i)=='e') {
				DREAMS[2]++;
			}
			else if(a.charAt(i)=='a') {
				DREAMS[3]++;
			}
			else if(a.charAt(i)=='m') {
				DREAMS[4]++;
			}
			else if(a.charAt(i)=='s') {
				DREAMS[5]++;
			}
		} if(a.charAt(i)=='d') {
				DREAMS[0]++;
			}
			else if(a.charAt(i)=='r') {
				DREAMS[1]++;
			}
			else if(a.charAt(i)=='e') {
				DREAMS[2]++;
			}
			else if(a.charAt(i)=='a') {
				DREAMS[3]++;
			}
			else if(a.charAt(i)=='m') {
				DREAMS[4]++;
			}
			else if(a.charAt(i)=='s') {
				DREAMS[5]++;
			} a.charAt(i)=='d' a.charAt(i) a.charAt a i 'd' {
				DREAMS[0]++;
			} DREAMS[0]++ DREAMS[0] DREAMS 0 if(a.charAt(i)=='r') {
				DREAMS[1]++;
			}
			else if(a.charAt(i)=='e') {
				DREAMS[2]++;
			}
			else if(a.charAt(i)=='a') {
				DREAMS[3]++;
			}
			else if(a.charAt(i)=='m') {
				DREAMS[4]++;
			}
			else if(a.charAt(i)=='s') {
				DREAMS[5]++;
			} a.charAt(i)=='r' a.charAt(i) a.charAt a i 'r' {
				DREAMS[1]++;
			} DREAMS[1]++ DREAMS[1] DREAMS 1 if(a.charAt(i)=='e') {
				DREAMS[2]++;
			}
			else if(a.charAt(i)=='a') {
				DREAMS[3]++;
			}
			else if(a.charAt(i)=='m') {
				DREAMS[4]++;
			}
			else if(a.charAt(i)=='s') {
				DREAMS[5]++;
			} a.charAt(i)=='e' a.charAt(i) a.charAt a i 'e' {
				DREAMS[2]++;
			} DREAMS[2]++ DREAMS[2] DREAMS 2 if(a.charAt(i)=='a') {
				DREAMS[3]++;
			}
			else if(a.charAt(i)=='m') {
				DREAMS[4]++;
			}
			else if(a.charAt(i)=='s') {
				DREAMS[5]++;
			} a.charAt(i)=='a' a.charAt(i) a.charAt a i 'a' {
				DREAMS[3]++;
			} DREAMS[3]++ DREAMS[3] DREAMS 3 if(a.charAt(i)=='m') {
				DREAMS[4]++;
			}
			else if(a.charAt(i)=='s') {
				DREAMS[5]++;
			} a.charAt(i)=='m' a.charAt(i) a.charAt a i 'm' {
				DREAMS[4]++;
			} DREAMS[4]++ DREAMS[4] DREAMS 4 if(a.charAt(i)=='s') {
				DREAMS[5]++;
			} a.charAt(i)=='s' a.charAt(i) a.charAt a i 's' {
				DREAMS[5]++;
			} DREAMS[5]++ DREAMS[5] DREAMS 5 int x=0 x 0 y=0 y 0 z=0 z 0 w=0; w 0 x=2*DREAMS[3]-DREAMS[2] x 2*DREAMS[3]-DREAMS[2] 2*DREAMS[3] 2 DREAMS[3] DREAMS 3 DREAMS[2] DREAMS 2 y=DREAMS[2]-DREAMS[5]*2-DREAMS[4] y DREAMS[2]-DREAMS[5]*2-DREAMS[4] DREAMS[2]-DREAMS[5]*2-DREAMS[4] DREAMS[2] DREAMS 2 DREAMS[5]*2 DREAMS[5] DREAMS 5 2 DREAMS[4] DREAMS 4 z=DREAMS[1]+DREAMS[5]-DREAMS[2] z DREAMS[1]+DREAMS[5]-DREAMS[2] DREAMS[1]+DREAMS[5] DREAMS[1] DREAMS 1 DREAMS[5] DREAMS 5 DREAMS[2] DREAMS 2 w=DREAMS[2]-DREAMS[1] w DREAMS[2]-DREAMS[1] DREAMS[2] DREAMS 2 DREAMS[1] DREAMS 1 if(a.length()==x*5+y*7+6*z+5*w) {
			if(x+y==DREAMS[0]) {
				if(x+2*y+2*z+w==DREAMS[1]) {
					if(x+2*y+z*2+w*2==DREAMS[2]) {
						if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		} a.length()==x*5+y*7+6*z+5*w a.length() a.length a x*5+y*7+6*z+5*w 6*z x*5+y*7+6*z+5*w x*5 x 5 y*7 y 7 6*z 6 z 5*w 5 w {
			if(x+y==DREAMS[0]) {
				if(x+2*y+2*z+w==DREAMS[1]) {
					if(x+2*y+z*2+w*2==DREAMS[2]) {
						if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		} if(x+y==DREAMS[0]) {
				if(x+2*y+2*z+w==DREAMS[1]) {
					if(x+2*y+z*2+w*2==DREAMS[2]) {
						if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						}
					}
				}
			} x+y==DREAMS[0] x+y x y DREAMS[0] DREAMS 0 {
				if(x+2*y+2*z+w==DREAMS[1]) {
					if(x+2*y+z*2+w*2==DREAMS[2]) {
						if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						}
					}
				}
			} if(x+2*y+2*z+w==DREAMS[1]) {
					if(x+2*y+z*2+w*2==DREAMS[2]) {
						if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						}
					}
				} x+2*y+2*z+w==DREAMS[1] x+2*y+2*z+w 2*z x+2*y+2*z+w x 2*y 2 y 2*z 2 z w DREAMS[1] DREAMS 1 {
					if(x+2*y+z*2+w*2==DREAMS[2]) {
						if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						}
					}
				} if(x+2*y+z*2+w*2==DREAMS[2]) {
						if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						}
					} x+2*y+z*2+w*2==DREAMS[2] x+2*y+z*2+w*2 z*2 x+2*y+z*2+w*2 x 2*y 2 y z*2 z 2 w*2 w 2 DREAMS[2] DREAMS 2 {
						if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						}
					} if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						} x+y+z+w==DREAMS[3] x+y+z+w z x+y+z+w x y z w DREAMS[3] DREAMS 3 {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						} if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							} x+y==DREAMS[4] x+y x y DREAMS[4] DREAMS 4 {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							} if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								} z+w==DREAMS[5] z+w z w DREAMS[5] DREAMS 5 {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								} if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									} x>=0 x 0 {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									} if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										} y>=0 y 0 {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										} if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											} z>=0 z 0 {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											} if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												} w>=0 w 0 {
													System.out.println("YES");
													System.exit(0);
												} System.out.println("YES") System.out.println System.out System System.out "YES" System.exit(0) System.exit System 0 System.out.println("NO") System.out.println System.out System System.out "NO" String[] args args

import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String a=sc.next();
		int[] DREAMS=new int[6];
		for(int i=0; i<6; i++) {
			DREAMS[i]=0;
		}

		for(int i=0; i<a.length(); i++) {
			if(a.charAt(i)=='d') {
				DREAMS[0]++;
			}
			else if(a.charAt(i)=='r') {
				DREAMS[1]++;
			}
			else if(a.charAt(i)=='e') {
				DREAMS[2]++;
			}
			else if(a.charAt(i)=='a') {
				DREAMS[3]++;
			}
			else if(a.charAt(i)=='m') {
				DREAMS[4]++;
			}
			else if(a.charAt(i)=='s') {
				DREAMS[5]++;
			}
		}

		int x=0,y=0,z=0,w=0;

		x=2*DREAMS[3]-DREAMS[2];
		y=DREAMS[2]-DREAMS[5]*2-DREAMS[4];
		z=DREAMS[1]+DREAMS[5]-DREAMS[2];
		w=DREAMS[2]-DREAMS[1];

		//System.out.println(x+" "+y+" "+z+" "+w);

		if(a.length()==x*5+y*7+6*z+5*w) {
			if(x+y==DREAMS[0]) {
				if(x+2*y+2*z+w==DREAMS[1]) {
					if(x+2*y+z*2+w*2==DREAMS[2]) {
						if(x+y+z+w==DREAMS[3]) {
							if(x+y==DREAMS[4]) {
								if(z+w==DREAMS[5]) {
									if(x>=0) {
										if(y>=0) {
											if(z>=0) {
												if(w>=0) {
													System.out.println("YES");
													System.exit(0);
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		System.out.println("NO");
	}
}