#abc364a. A - Glutton Takahashi
A - Glutton Takahashi
Score : points
问题陈述
高桥计划吃 道菜。
他计划吃的第 道菜如果是甜的,那么 甜的
;如果是咸的,那么 咸的
。
如果他连续吃两道甜菜,他会感觉恶心,无法再吃任何菜。
确定他是否能吃完所有菜。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
Takahashi is planning to eat dishes.
The -th dish he plans to eat is sweet if sweet
, and salty if 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
- is an integer between and , inclusive.
- Each is
sweet
orsalty
.
Input
The input is given from Standard Input in the following format:
Output
Print Yes
if Takahashi can eat all the dishes, and No
otherwise.
Sample Input 1
5
salty
sweet
salty
salty
sweet
Sample Output 1
Yes
He will not eat two sweet dishes consecutively, so he can eat all the dishes without feeling sick.
Sample Input 2
4
sweet
salty
sweet
sweet
Sample Output 2
Yes
He will feel sick but can still eat all the dishes.
Sample Input 3
6
salty
sweet
sweet
salty
sweet
sweet
Sample Output 3
No
He feels sick when eating the 3rd dish and cannot eat the 4th and subsequent dishes.