Glutton Takahashi

AtCoder
IDabc364_a
Time2000ms
Memory256MB
Difficulty
Takahashi is planning to eat $N$ dishes. The $i$\-th dish he plans to eat is sweet if $S_i =$ `sweet`, and salty if $S_i =$ `salty`. If he eats two sweet dishes consecutively, he will feel sick and be unable to eat any more dishes. Determine whether he can eat all the dishes. ## Constraints * $N$ is an integer between $1$ and $100$, inclusive. * Each $S_i$ is `sweet` or `salty`. ## Input The input is given from Standard Input in the following format: $N$ $S_1$ $S_2$ $\vdots$ $S_N$ [samples]
Samples
Input #1
5
salty
sweet
salty
salty
sweet
Output #1
Yes

He will not eat two sweet dishes consecutively, so he can eat all the dishes without feeling sick.
Input #2
4
sweet
salty
sweet
sweet
Output #2
Yes

He will feel sick but can still eat all the dishes.
Input #3
6
salty
sweet
sweet
salty
sweet
sweet
Output #3
No

He feels sick when eating the 3rd dish and cannot eat the 4th and subsequent dishes.
API Response (JSON)
{
  "problem": {
    "name": "Glutton Takahashi",
    "description": {
      "content": "Takahashi is planning to eat $N$ dishes. The $i$\\-th dish he plans to eat is sweet if $S_i =$ `sweet`, and salty if $S_i =$ `salty`. If he eats two sweet dishes consecutively, he will feel sick and be",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc364_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Takahashi is planning to eat $N$ dishes.\nThe $i$\\-th dish he plans to eat is sweet if $S_i =$ `sweet`, and salty if $S_i =$ `salty`.\nIf he eats two sweet dishes consecutively, he will feel sick and be...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments