####準備
[C#でAtCoderデビューのための準備]
(https://qiita.com/azumabashi/items/7aa9e4b77c10970cc30a)
のあとで AtCoder Beginners Selection をやってみました。
####問題文
ABC049C - 白昼夢
[https://atcoder.jp/contests/abs/tasks/arc065_a]
(https://atcoder.jp/contests/abs/tasks/arc065_a)
####提出結果
using System;
class Program
{
static void Main(string[] args)
{
string S = Console.ReadLine();
// dream dreamer erase eraser
string dm = "dream";
string dmr = "dreamer";
string er = "erase";
string err = "eraser";
int dml = dm.Length;
int dmrl = dmr.Length;
int erl = er.Length;
int errl = err.Length;
string chkS = S;
string result = "YES";
while (true)
{
if (chkS.Length >= dml)
{
if (chkS.Substring(chkS.Length - dml, dml) == dm)
{
if (chkS.Length == dml)
{
break;
}
else
{
chkS = chkS.Substring(0, chkS.Length - dml);
continue;
}
}
}
if (chkS.Length >= dmrl)
{
if (chkS.Substring(chkS.Length - dmrl, dmrl) == dmr)
{
if (chkS.Length == dmrl)
{
break;
}
else
{
chkS = chkS.Substring(0, chkS.Length - dmrl);
continue;
}
}
}
if (chkS.Length >= erl)
{
if (chkS.Substring(chkS.Length - erl, erl) == er)
{
if (chkS.Length == erl)
{
break;
}
else
{
chkS = chkS.Substring(0, chkS.Length - erl);
continue;
}
}
}
if (chkS.Length >= errl)
{
if (chkS.Substring(chkS.Length - errl, errl) == err)
{
if (chkS.Length == errl)
{
break;
}
else
{
chkS = chkS.Substring(0, chkS.Length - errl);
continue;
}
}
}
result = "NO";
break;
}
Console.WriteLine($"{result}");
}
}