103270: [Atcoder]ABC327 A - ab

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:11 Solved:0

Description

Score : $100$ points

Problem Statement

You are given a string $S$ of length $N$ consisting of lowercase English letters.
If there are any adjacent occurrences of a and b in $S$, print Yes; otherwise, print No. (The order of a and b does not matter.)

Constraints

  • $2 \leq N \leq 100$
  • $S$ is a string of length $N$ consisting of lowercase English letters.

Input

The input is given from Standard Input in the following format:

$N$
$S$

Output

If there are any adjacent occurrences of a and b in $S$, print Yes; otherwise, print No.


Sample Input 1

3
abc

Sample Output 1

Yes

The string abc has a as the first character and b as the second character, which are adjacent. Thus, print Yes.


Sample Input 2

2
ba

Sample Output 2

Yes

The string ba has a as the second character and b as the first character, which are adjacent. (Note that the order of a and b does not matter.)


Sample Input 3

7
atcoder

Sample Output 3

No

Output

得分:100分

问题描述

给你一个长度为 N 的字符串 S,由小写英文字母组成。

如果 S 中存在相邻的字符 ab,请打印 Yes;否则,打印 No。(ab 的顺序无关紧要。)

限制条件

  • $2 \leq N \leq 100$
  • $S$ 是一个长度为 $N$ 的字符串,由小写英文字母组成。

输入

输入从标准输入按以下格式给出:

$N$
$S$

输出

如果 S 中存在相邻的字符 ab,请打印 Yes;否则,打印 No


样例输入 1

3
abc

样例输出 1

Yes

字符串 abc 中第一个字符是 a,第二个字符是 b,它们相邻。因此,打印 Yes


样例输入 2

2
ba

样例输出 2

Yes

字符串 ba 中第二个字符是 a,第一个字符是 b,它们相邻。(注意 ab 的顺序无关紧要。)


样例输入 3

7
atcoder

样例输出 3

No

HINT

字符串中是否出现过相邻的a和b?

加入题单

上一题 下一题 算法标签: