/
実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 200 点
問題文
高橋君は列車の座席を予約しようとしています。
高橋君が予約する候補としている列車は N 本あり、列車 1,2,\dots,N と番号が付けられています。 いずれの列車も座席は 5 列からなり、それぞれ A 列、B 列、C 列、D 列、E 列と呼ばれています。
各列車の現在の空席情報が文字列 S_1,S_2,\dots,S_N として与えられます。
ここで S_1,S_2,\dots,S_N はすべて長さ 5 で、列車 i の A 列から E 列までがそれぞれ S_i の 1 文字目から 5 文字目と対応しており、その文字が o ならば対応する列に空席があることを、x ならば対応する列に空席がないことを意味します。
高橋君は X 列の席を予約したいです。ここで X は A、B、C、D、E のいずれかです。
1 本以上の列車において X 列に空席があるか判定してください。
制約
- N は 1 以上 100 以下の整数
- X は
A、B、C、D、Eのいずれか - S_i は
o、xからなる長さ 5 の文字列
入力
入力は以下の形式で標準入力から与えられる。
N X S_1 S_2 \vdots S_N
出力
1 本以上の列車において X 列に空席があるならば Yes を、そうでないならば No を出力せよ。
入力例 1
3 A xoxox xxooo oxxxx
出力例 1
Yes
列車 3 の A 列には空席があります。したがって Yes を出力してください。
入力例 2
5 C xoxoo oxxoo oxxxo xoxxx oxxoo
出力例 2
No
どの列車の C 列にも空席がありません。したがって No を出力してください。
Score : 200 points
Problem Statement
Takahashi is trying to reserve a seat on a train.
There are N trains he is considering as candidates for reservation, numbered 1, 2, \dots, N. Each train has seats in five columns, called column A, column B, column C, column D, and column E.
The current seat availability information for each train is given as strings S_1, S_2, \dots, S_N.
Here, S_1, S_2, \dots, S_N all have length 5, and columns A through E of train i correspond to the first through fifth characters of S_i, respectively. If that character is o, there is a vacant seat in the corresponding column; if it is x, there is no vacant seat in the corresponding column.
Takahashi wants to reserve a seat in column X, where X is one of A, B, C, D, E.
Determine whether there is a vacant seat in column X on at least one train.
Constraints
- N is an integer between 1 and 100, inclusive.
- X is one of
A,B,C,D,E. - S_i is a string of length 5 consisting of
oandx.
Input
The input is given from Standard Input in the following format:
N X S_1 S_2 \vdots S_N
Output
If there is a vacant seat in column X on at least one train, output Yes; otherwise, output No.
Sample Input 1
3 A xoxox xxooo oxxxx
Sample Output 1
Yes
Train 3 has a vacant seat in column A. Thus, output Yes.
Sample Input 2
5 C xoxoo oxxoo oxxxo xoxxx oxxoo
Sample Output 2
No
No train has a vacant seat in column C. Thus, output No.