

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 200 点
問題文
文字列 S が与えられます。S のそれぞれの文字は英大文字または英小文字です。 S が次の条件すべてを満たすか判定してください。
- S の先頭の文字は大文字の
A
である。 - S の先頭から 3 文字目と末尾から 2 文字目の間(両端含む)に大文字の
C
がちょうど 1 個含まれる。 - 以上の
A
,C
を除く S のすべての文字は小文字である。
制約
- 4 ≤ |S| ≤ 10 (|S| は文字列 S の長さ)
- S のそれぞれの文字は英大文字または英小文字である。
入力
入力は以下の形式で標準入力から与えられる。
S
出力
S が問題文中の条件すべてを満たすなら AC
、そうでなければ WA
と出力せよ。
入力例 1
AtCoder
出力例 1
AC
1 文字目が A
、3 文字目が C
でそれ以外の文字はすべて小文字であり、すべての条件を満たします。
入力例 2
ACoder
出力例 2
WA
2 文字目が C
であってはいけません。
入力例 3
AcycliC
出力例 3
WA
最後の文字が C
であってもいけません。
入力例 4
AtCoCo
出力例 4
WA
C
を 2 個以上含んではいけません。
入力例 5
Atcoder
出力例 5
WA
C
を 1 個も含まないのもいけません。
Score : 200 points
Problem Statement
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
- The initial character of S is an uppercase
A
. - There is exactly one occurrence of
C
between the third character from the beginning and the second to last character (inclusive). - All letters except the
A
andC
mentioned above are lowercase.
Constraints
- 4 ≤ |S| ≤ 10 (|S| is the length of the string S.)
- Each character of S is uppercase or lowercase English letter.
Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print AC
; otherwise, print WA
.
Sample Input 1
AtCoder
Sample Output 1
AC
The first letter is A
, the third letter is C
and the remaining letters are all lowercase, so all the conditions are satisfied.
Sample Input 2
ACoder
Sample Output 2
WA
The second letter should not be C
.
Sample Input 3
AcycliC
Sample Output 3
WA
The last letter should not be C
, either.
Sample Input 4
AtCoCo
Sample Output 4
WA
There should not be two or more occurrences of C
.
Sample Input 5
Atcoder
Sample Output 5
WA
The number of C
should not be zero, either.