C - Precondition 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MiB

配点 : 200

問題文

英小文字および英大文字のみからなる文字列 S, T が与えられます。

文字列 S が以下の条件を満たしているか判定してください。

  • S の先頭でない英大文字の直前の文字はすべて T に含まれる。より形式的には、2 \leq i \leq |S| なる整数 i について Si 番目の文字が英大文字ならば、Si-1 番目の文字は T に含まれる。

制約

  • S, T は長さ 1 以上 100 以下の英小文字および英大文字のみからなる文字列

入力

入力は以下の形式で標準入力から与えられる。

S
T

出力

S が問題文中の条件を満たしているとき Yes と出力せよ。そうでないとき、No と出力せよ。


入力例 1

AtCoder
Total

出力例 1

Yes

S の先頭でない英大文字は 3 番目の文字の C のみです。この直前の文字である tT に含まれているため、Yes と出力すればよいです。


入力例 2

aBCdE
abcdcba

出力例 2

No

S3 番目の文字は英大文字 C であり、その直前の文字は B ですが、BT に含まれていません。


入力例 3

abcde
XYZ

出力例 3

Yes

Score : 200 points

Problem Statement

You are given strings S and T consisting of lowercase and uppercase English letters.

Determine whether the string S satisfies the following condition:

  • Every uppercase letter in S that is not at the beginning is immediately preceded by a character contained in T. More formally, for all integers i such that 2 \leq i \leq |S|, if the i-th character of S is uppercase, then the (i-1)-th character of S is contained in T.

Constraints

  • Each of S and T is a string consisting of lowercase and uppercase English letters with length between 1 and 100, inclusive.

Input

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

S
T

Output

If S satisfies the condition in the problem statement, output Yes. Otherwise, output No.


Sample Input 1

AtCoder
Total

Sample Output 1

Yes

The only uppercase letter in S that is not at the beginning is the 3rd character C. The immediately preceding character t is contained in T, so output Yes.


Sample Input 2

aBCdE
abcdcba

Sample Output 2

No

The 3rd character of S is the uppercase letter C, and its immediately preceding character is B, but B is not contained in T.


Sample Input 3

abcde
XYZ

Sample Output 3

Yes