B - Sandwich Number Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 200

問題文

英大文字と数字からなる文字列 S が与えられるので、S が以下の条件を満たすか判定してください。

  • S は次の文字または文字列をこの順番で連結して得られる。
    • 一文字の英大文字
    • 100000 以上 999999 以下の整数を 10 進表記して得られる長さ 6 の文字列
    • 一文字の英大文字

制約

  • S は英大文字と数字からなる
  • S の長さは 1 以上 10 以下

入力

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

S

出力

S が問題文中の条件を満たすなら Yes と、満たさないなら No と出力せよ。


入力例 1

Q142857Z

出力例 1

Yes

SQ142857Z をこの順に連結して得られます。
QZ は英大文字であり、142857100000 以上 999999 以下の整数を 10 進表記して得られる長さ 6 の文字列なので、S は条件を満たします。


入力例 2

AB912278C

出力例 2

No

AB は一文字の英大文字ではないため、S は条件を満たしません。


入力例 3

X900000

出力例 3

No

S の末尾の一文字が英大文字ではないため、S は条件を満たしません。


入力例 4

K012345K

出力例 4

No

012345100000 以上 999999 以下の整数を 10 進表記して得られる長さ 6 の文字列ではないため、S は条件を満たしません。

Score : 200 points

Problem Statement

You are given a string S consisting of uppercase English letters and digits. Determine whether S satisfies the following condition.

  • S is a concatenation of the following characters and string in the order listed.
    • An uppercase English letter
    • A string of length 6 that is a decimal representation of an integer between 100000 and 999999, inclusive
    • An uppercase English letter

Constraints

  • S consists of uppercase English letters and digits.
  • The length of S is between 1 and 10, inclusive.

Input

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

S

Output

If S satisfies the condition in the problem statement, print Yes; otherwise, print No.


Sample Input 1

Q142857Z

Sample Output 1

Yes

S is a concatenation of Q, 142857, and Z in this order.
Q and Z are uppercase English letters, and 142857 is a string of length 6 that is a decimal representation of an integer between 100000 and 999999, so S satisfies the condition.


Sample Input 2

AB912278C

Sample Output 2

No

AB is not an uppercase English letter, so S does not satisfy the condition.


Sample Input 3

X900000

Sample Output 3

No

The last character of S is not an uppercase English letter, so S does not satisfy the condition.


Sample Input 4

K012345K

Sample Output 4

No

012345 is not a string of length 6 that is a decimal representation of an integer between 100000 and 999999, so S does not satisfy the condition.