Module Main

    Sub Main()

        Dim strInputVal As String = String.Empty            '入力値
        Dim strCompVal() As String = {"dream", "dreamer", "erase", "eraser"} '比較値
        Dim intInputLen As Integer = 0                      '入力値(長さ)
        Dim intCompLen As Integer = 0                       '比較値(長さ)

        '入力値取得
        strInputVal = Console.ReadLine()
        intInputLen = strInputVal.Length

        For i As Integer = 0 To strCompVal.Length - 1

            '比較文字列の文字数をセット
            intCompLen = strCompVal(i).Length

            '末尾の文字列と一致する場合
            If intInputLen < intCompLen Then
                Continue For
            End If

            If strInputVal.Substring(intInputLen - intCompLen).Equals(strCompVal(i)) Then
                Console.WriteLine("YES")
                Exit Sub
            End If

        Next

        '一致しなかった場合
        Console.WriteLine("NO")

    End Sub

End Module
