def main():

    S = input()[::-1]

    tar = {'maerd', 'remaerd', 'esare', 'resare'}

    i = 0

    while i < len(S):

        if S[i] == 'm':

            if S[i:i+5] == 'maerd':

                i += 5

            else:

                return print("NO")

        elif S[i] == 'e':

            if S[i:i+5] == 'esare':

                i += 5

            else:

                return print("NO")

        elif S[i] == 'r':

            if S[i:i+6] == 'resare':

                i += 6

            elif S[i:i+7] == 'remaerd':

                i += 7

            else:

                return print("NO")

        else:

            return print("NO")

    print("YES")

if __name__ == '__main__':

    main()

def main():

    S = input()

    S = S[::-1]

    ans = ["maerd", "remaerd", "esare", "resare"]

    while S:

        for a in ans:

            if S[:5] in ans:

                S = S.replace(S[:5], "", 1)

                break

            elif S[:6] in ans:

                S = S.replace(S[:6], "", 1)

                break

            elif S[:7] in ans:

                S = S.replace(S[:7], "", 1)

                break

        else:

            return print("NO")

    else:

        return print("YES")





if __name__ == '__main__':

    main()

def main():
    S = input()[::-1]
    tar = {"maerd", "remaerd", "esare", "resare"}
    i = 0
    while i < len(S):
        if S[i] == "m":
            if S[i : i + 5] == "maerd":
                i += 5
            else:
                return print("NO")
        elif S[i] == "e":
            if S[i : i + 5] == "esare":
                i += 5
            else:
                return print("NO")
        elif S[i] == "r":
            if S[i : i + 6] == "resare":
                i += 6
            elif S[i : i + 7] == "remaerd":
                i += 7
            else:
                return print("NO")
        else:
            return print("NO")
    print("YES")


if __name__ == "__main__":
    main()

def main():
    S = input()
    S = S[::-1]
    ans = ["maerd", "remaerd", "esare", "resare"]
    while S:
        for a in ans:
            if S[:5] in ans:
                S = S.replace(S[:5], "", 1)
                break
            elif S[:6] in ans:
                S = S.replace(S[:6], "", 1)
                break
            elif S[:7] in ans:
                S = S.replace(S[:7], "", 1)
                break
        else:
            return print("NO")
    else:
        return print("YES")


if __name__ == "__main__":
    main()

-    S = input()[::-1] -    tar = {"maerd", "remaerd", "esare", "resare"} -    i = 0 -    while i < len(S): -        if S[i] == "m": -            if S[i : i + 5] == "maerd": -                i += 5 -            else: -                return print("NO") -        elif S[i] == "e": -            if S[i : i + 5] == "esare": -                i += 5 -            else: -                return print("NO") -        elif S[i] == "r": -            if S[i : i + 6] == "resare": -                i += 6 -            elif S[i : i + 7] == "remaerd": -                i += 7 -            else: -                return print("NO") +    S = input() +    S = S[::-1] +    ans = ["maerd", "remaerd", "esare", "resare"] +    while S: +        for a in ans: +            if S[:5] in ans: +                S = S.replace(S[:5], "", 1) +                break +            elif S[:6] in ans: +                S = S.replace(S[:6], "", 1) +                break +            elif S[:7] in ans: +                S = S.replace(S[:7], "", 1) +                break -    print("YES") +    else: +        return print("YES")