

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 100 点
問題文
英小文字からなる長さ N の文字列 S が与えられます。
S の中で a
と b
が隣接する箇所があれば Yes
を、なければ No
を出力してください。(a
と b
の順序は問いません。)
制約
- 2 \leq N \leq 100
- S は英小文字からなる長さ N の文字列
入力
入力は以下の形式で標準入力から与えられる。
N S
出力
S の中で a
と b
が隣接する箇所があれば Yes
を、なければ No
を出力せよ。
入力例 1
3 abc
出力例 1
Yes
文字列 abc
は 1 文字目にある a
と 2 文字目にある b
が隣接しています。よって Yes
を出力してください。
入力例 2
2 ba
出力例 2
Yes
文字列 ba
は 2 文字目にある a
と 1 文字目にある b
が隣接しています。(a
と b
の順番は逆でも良い点に注意してください。)
入力例 3
7 atcoder
出力例 3
No
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