Daydream

AtCoder
IDarc065_a
Time2000ms
Memory256MB
Difficulty
You are given a string $S$ consisting of lowercase English letters. Another string $T$ is initially empty. Determine whether it is possible to obtain $S = T$ by performing the following operation an arbitrary number of times: * Append one of the following at the end of $T$: `dream`, `dreamer`, `erase` and `eraser`. ## Constraints * $1≦|S|≦10^5$ * $S$ consists of lowercase English letters. ## Input The input is given from Standard Input in the following format: $S$ [samples]
Samples
Input #1
erasedream
Output #1
YES

Append `erase` and `dream` at the end of $T$ in this order, to obtain $S = T$.
Input #2
dreameraser
Output #2
YES

Append `dream` and `eraser` at the end of $T$ in this order, to obtain $S = T$.
Input #3
dreamerer
Output #3
NO
API Response (JSON)
{
  "problem": {
    "name": "Daydream",
    "description": {
      "content": "You are given a string $S$ consisting of lowercase English letters. Another string $T$ is initially empty. Determine whether it is possible to obtain $S = T$ by performing the following operation an a",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc065_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given a string $S$ consisting of lowercase English letters. Another string $T$ is initially empty. Determine whether it is possible to obtain $S = T$ by performing the following operation an a...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments