Problem:


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 and C 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.



Sample input:
AtCoder


Sample output:
AC

Submission status: Accepted

Solution code:
s = list(input())
ans = "AC"

if s[0] == "A" and "C" in s[2:-1] and s.count("C") == 1 and s[1].islower():
    for i in range(3, len(s)):
        if not s[i].islower() and s[i] != "C":
            ans = "WA"
            break
else:
    ans = "WA"

print(ans)

Submission status: Accepted

Solution code:
s = list(input())
alph = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
c = 1
m = 0
for i in range(len(s)):
    if i == 0:
        if s[i] != "A":
            c = 0
    elif i == 1 or i == len(s) - 1:
        if not s[i] in alph:
            c = 0
    else:
        if m == 0 and not s[i] in alph:
            if s[i] == "C":
                m += 1
            else:
                c = 0
        elif m == 1 and not s[i] in alph:
            c = 0
if m == 0:
    c = 0
print("AC" if c == 1 else "WA")

Submission status: Accepted

Solution code:
s = input().strip()

if s[0] != 'A':
    print('WA')
else:
    i = 0
    j = 0
    for k in range(2, len(s) - 1):
        if s[k] == 'C':
            i += 1
        if s[k].islower():
            j += 1
    if s[-1].islower() and s[1].islower():
        j += 2
    if i == 1 and j == len(s) - 2:
        print('AC')
    else:
        print('WA')

Submission status: Accepted

Solution code:
import re
print("AC" if re.match("^A[a-z]+C[a-z]+$",input()) else "WA")

Submission status: Accepted

Solution code:
import re
ans=re.match("A[a-z]+C[a-z]+$",input())
print("AC" if ans else "WA")

Submission status: Accepted

Solution code:
import re
ans=re.match("^A[a-z]+C[a-z]+$",input())
print("AC" if ans else "WA")

Submission status: Accepted

Solution code:
a = input()
S = list(a)

count = 0
if S[0] == "A":
    count += 1
    # print("OK")

vaa = 0
num=[0]
for j in range(2, len(S)-1):
    # print(j)
    if S[j] == "C":
        vaa += 1
        num.append(j)

if vaa == 1:
    count += 1
    # print("OK")

# val = 0
# for i in range(len(S)):
#     for j in range(len(S)):
#         if j == 0 or j == num:
#             print(j)
#             continue
#         else:
#             if S[i] == S_low[j]:
#                 print(S[i])
#                 print(S[j])
#                 val += 1
#             else:
#                 continue
# print("val", val)
# if val == len(S)-2:
#     count +=1
# print(num)
num = reversed(num)
S_pop = [S.pop(i) for i in num]
S_low = [i.lower() for i in S]

# print("S", S)
# print("S_low", S_low)

if S == S_low:
    count += 1

if count == 3:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
import math

s=input()
x=s.find("C")

ok=True

for i in range(len(s)):
    if i==0 or i==x:
        continue

    if not s[i].islower():
        ok=False




if(s[0]=='A' and 2<=x<=len(s)-2 and ok):
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = list(str(input()))
import sys
if s[0] != 'A':
    print('WA')
    sys.exit()
s.remove('A')
s2 = s[1:-1]
if s2.count('C') != 1:
    print('WA')
    sys.exit()
s.remove('C')
low = list(map(str.lower, s))
if low != s:
    print('WA')
    sys.exit()
print('AC')

Submission status: Accepted

Solution code:
#!python3

# input
S = input()


def main():
    x = S[0] == 'A'
    y = S[2:-1].count('C') == 1
    z = sum([1 for s in S if 'A' <= s <= 'Z']) == 2
    if x and y and z:
        ans = "AC"
    else:
        ans = "WA"
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()

C_S = S[2 : len(S) - 1]

#flag = True
if S[0] != 'A':
    #flag = False
    print('WA')
    quit()
    #break
if not 'C' in C_S and C_S.count('C') != 1:
    #flag = False
    #break
    print('WA')
    quit()
c_index = S.index('C')
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(len(S)):
    if i == 0 or i == c_index:
        continue
    elif S[i] not in alpha:
        #flag = False
        #break
        print('WA')
        quit()
    else:
        continue
print('AC')

Submission status: Accepted

Solution code:
S = input()

import sys

if S[0] != "A":
    print("WA")
    sys.exit()
else:
    if S[2:len(S)-1].count("C") != 1:
        print("WA")
        sys.exit()
    else:
        for i in range(1,len(S)):
            if 97 <= ord(S[i]) and ord(S[i]) <= 122:
                continue
            elif S[i] == "C":
                continue
            else:
                print("WA")
                sys.exit()
    print("AC")

Submission status: Accepted

Solution code:
s=input()
if s[0]=="A":
    if s[2:-1].count("C")==1:
        s=s.replace("C","c")
        S=s[1:]
        if S.islower():
            print("AC")
            exit()
print("WA")

Submission status: Accepted

Solution code:
s = input()

if s[0] != 'A':
    print("WA")
    exit()
cnt = 0
s_list = list(s)
s_list[0] = 'a'
for i in range(2, len(s) - 1):
    if s[i] == 'C':
        s_list[i] = 'c'
        cnt += 1
if cnt != 1:
    print("WA")
    exit()
s = "".join(s_list)
for i in range(len(s)):
    if ord(s[i]) >= ord("A") and ord(s[i]) <= ord("Z"):
        print("WA")
        exit()

print("AC")

Submission status: Accepted

Solution code:
s = input()
if s[0]=='A':
    if s[2:-1].count('C')==1:
        s = s.replace('A', 'a').replace('C', 'c')
        if s.islower():
            print('AC')
            exit()

print('WA')

Submission status: Accepted

Solution code:
S=input()
if S[0]!='A':
    print("WA")
    exit()
s=S[2:len(S)-1]
#print(s)
if s.count('C')!=1:
    print("WA")
    exit()
S1=list(S)
S1.remove('A')
S1.remove('C')
alpha="abcdefghijklmnopqrstuvwxyz"
for s in S1:
    if not('a'<=s<='z'):
    #if s not in alpha:
        #print(s)
        print("WA")
        exit()
print("AC")

Submission status: Accepted

Solution code:
S=input()
if S[0]!='A':
    print("WA")
    exit()
s=S[2:len(S)-1]
#print(s)
if s.count('C')!=1:
    print("WA")
    exit()
S1=list(S)
S1.remove('A')
S1.remove('C')
alpha="abcdefghijklmnopqrstuvwxyz"
for s in S1:
    if s not in alpha:
        #print(s)
        print("WA")
        exit()
print("AC")

Submission status: Accepted

Solution code:
ans = True
key = 0
s = input()

for i in range(len(s)):
  if i == 0 and s[0] != "A":
    ans = False
  if (i == 1 or i == len(s)-1) and s[i].isupper():
    ans = False
  if 2 <= i <= len(s)-2:
    if s[i] == "C":
      key += 1
    elif s[i].isupper():
      ans = False
if key == 1 and ans:
  print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
s=input()
cnt_c=0
for i in s:
    if i=='C':
        cnt_c+=1
c_present=False
n=len(s)
for i in range(2,n-1):
    if s[i]=='C':
        c_present=True
flag=True
for i in s:
    if i!='A' and i!='C':
        if i.isupper():
            flag=False
if s[0]=='A' and cnt_c==1 and c_present and  flag:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
import sys
S = input()
SL = list(S)
N = len(S)

if S[0] != "A":
    print("WA")
    sys.exit()

if S[2:-1].count("C") != 1:
    print("WA")
    sys.exit()

SL[0] = "a"
for i in range(2,N-1):
    if SL[i] == "C":
        SL[i] = "c"
        break
S2 = "".join(SL)
if not S2.islower():
    print("WA")
    sys.exit()
print("AC")

Submission status: Accepted

Solution code:
s = input()
flag = True
if s[0] != 'A':
    flag = False

cnt_second = 0
second = s[2:-1]
for x in second:
    if x == 'C':
        cnt_second += 1

if cnt_second != 1:
    flag = False

cnt_third = 0
for x in s:
    if x.isupper():
        cnt_third += 1

if cnt_third != 2:
    flag = False

print('AC' if flag == True else 'WA')

Submission status: Accepted

Solution code:
s=input()
p=len(s)
fir=s[0]=="A"
sec=s.count("C",2,-1)
thi=sum(map(lambda x:x.islower(), s))==p-2
if fir and sec and thi:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s=input()
if s[0]=="A" and s[2:-1].count("C")==1:
  c=s[2:-1].index("C")
  if s[1:c+2].islower() and s[c+3:].islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
 
cond1 = True if S[0] == 'A' else False
cond2 = True if S[2:-1].count('C') == 1 else False
cond3 = True if sum(map(lambda x: x.islower(), S)) == N-2 else False
 
print('AC') if cond1 and cond2 and cond3 else print('WA')

Submission status: Accepted

Solution code:
S=input()
flag=False

if S[0]=="A":
  if S[2:-1].count("C")==1:
    pos=S.find("C")
    T=S[1:pos]+S[pos+1:]
    if T.islower():
      print("AC")
      flag=True
      
if flag==False:
  print("WA")

Submission status: Accepted

Solution code:
S = input()
l = len(S)
cnt = 0
if (S[0] == "A"):
    for i in range(2, l - 1):
        if (S[i] == "C"):
            cnt += 1

    if (cnt == 1):
        f = True
        for i in range(len(S)):
            if (S[i] != "A") and (S[i] != "C"):
                if (S[i].isupper()):
                    f = False
                    break
        if (f):
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = list(input())
if (s[0]=="A") and (s[2:-1].count("C")==1):
  s.remove("A")
  s.remove('C')
  if str(s).islower():
    print("AC")
  else:
    print('WA')
else:
  print('WA')

Submission status: Accepted

Solution code:
import sys
s = input()
state = False
if s[0] != "A":
    print("WA")
    sys.exit()
cnt = 0
for i in range(2,len(s)-1):
    if s[i] == "C":
        cnt +=1
if cnt != 1:
    print("WA")
    sys.exit()
for i in range(len(s)):
    if s[i] == "A":
        continue
    elif s[i] == "C":
        continue
    elif s[i].islower():
        continue
    else:
        print("WA")
        sys.exit()
print("AC")

Submission status: Accepted

Solution code:
s=input()

if s[0]=="A":
  if s[2:-1].count("C")==1:
    if s.count("A")==1 and s.count("C")==1 and s[1].islower()==True and s[-1].islower()==True:
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")

Submission status: Accepted

Solution code:
s=input()
print('AC' if s[0] == 'A' and s[2:-1].count('C') ==1 and s[1:].replace('C','',1).islower() else 'WA')

Submission status: Accepted

Solution code:
import sys


def main():
    s = list(input())
    if s[0] != 'A' or s[2:-1].count("C") != 1:
        print("WA")
    else:
        for i in range(1, len(s)):
            if ord(s[i]) < ord('a') and i != s.index('C'):
                print("WA")
                sys.exit(0)
        print("AC")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()

if S[0]=='A' and S[2:len(S)-1].count('C') == 1:
    flag = True
    for i in range(1,len(S)):
        if ord(S[i]) < ord('a') and i != S.index('C'):
            flag = False
            break
    if flag:
        print('AC')
    else:
        print('WA')
else:
    print('WA')

Submission status: Accepted

Solution code:
s = input()
flg = 0
if s[0] != "A":
  flg = 1
if s[2:-1].count("C") != 1:
  flg = 1
else:
  l = s.index("C")
  s = s[1:l] + s[l+1:]
  if s.islower():
    pass
  else:
    flg = 1
if flg == 1:
  print("WA")
else:
  print("AC")

Submission status: Accepted

Solution code:
import numpy as np

S = input()
cond1 = (S[0] == 'A')

cntC = S.count('C', 2, len(S)-1)
cond2 = (cntC == 1)

cnt_lower = 0
for c in S:
    if c.islower():
        cnt_lower += 1
cond3 = (cnt_lower == len(S)-2)

if(cond1 and cond2 and cond3):
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
i=0
j=0
#N=int(input())
#N, W=input().split()
S=input()
#T=input()
#S_list=list(S)
#h_list=  list(map(int, input().split(" ")))
#M=int(input())
#drink_list = [list(map(int, input().split(" ")))for i in range(M)]
#print(T_list[1])
#N=int(N)
#W=int(W)
#不本意だが内包表記で二次元の空のリストを作成する

#dp=[['' for i in range(2)] for j in range(N)]
#K=int(K)
#S_list=[]
sentence_list=[]
#total=0
#mojiretu=""
#センテンスを暗記するのではなく、まずinput()を書いて、膨らます感じで記述する。すると#思考の流れ通りに書ける。素晴らしい！
#for i in range(K):
# ID_list.append(i+1)
#print(ID_list)
#for i in range(H)
#この下の行が二次元リストの読み込
#intを消して記号を読み込めるようにしたしかしこれでは文字列から読み込んでいるのと同じ
#weight_value_list =  [list(input())for i in range(N)]#一文字づつばらして入れてしまう
#s = [input() for i in range(N)]
#複数行に複数の入力値を取得し、出力する
#sentence_list =  (list(input())for i in range(N))
#for i in range(H):
#  ppixel_list=list(input())
#
#print(pixel_list)
#high_pixel_list =[['' for i in range(W)]for j in range(2*H)]
#print(high_pixel_list)
#print(pixel_list[0][1])#行　列の順番にかっこが並んでいる
#print(a_list)
first_term=0
second_term=0
#整数二次元配列を読み込む時のやり方
#a_b_c_list =  [list(map(int, input().split(" ")))for i in range(N)]

#センテンスを暗記するのではなく、まずinput()を書いて、膨らます感じで記述する。すると#思考の流れ通りに書ける。素晴らしい！
#print(S)
#sentence_list=sorted(S)
p=-10000
sentence_list=list(S)
#print(sentence_list)
#スペースでいれつつ値を取得
if len(S) <4 or len(S) > 10:
    print("WA")
    sys.exit()

if sentence_list[0]=="A":# and sentence_list[2]=="C":
    #print(1231234)
    #del sentence_list[0]
    pass
else:
    print("WA")
    sys.exit()

for j in range(len(sentence_list)-3):
    #print(len(S))
    #print(sentence_list[j+2])
    #if j+4==len(sentence_list):
        #print("WA")

        #sys.exit()
    if sentence_list[j+2]=="C":
        #del sentence_list[j+2]
        p=j+2
        break

#print(sentence_list)
if p> 0:
    del sentence_list[p]
if p< 0:
    print("WA")
    sys.exit()
del sentence_list[0]
#print(sentence_list)

S="".join(sentence_list)

if S.islower()==True:
    print("AC")
    sys.exit()
#print(123)
print("WA")


#x, y = [0]*N, [0]*N#N個の空のリストを作成
#l = list(range(N))#範囲がNのリストを作成する

#for i in range(N):
#  x[i], y[i] = map(int, input().split())
#分けて入力する形式を設定することで可読性が高く仕上がっている
#素晴らしいことだ


distance = 0
#comb = list(itertools.permutations(l))
#prmutation:英語の意味としては順列である
'''p[, r]で
長さrのタプル列、重複なしのあらゆる並びを表す
今回はリストlの重複なしの並び替え順序を新たなリストに収納している
並び方を計算しリストに収納しているイメージ
l[0,1,2]
l[0,2,1]これにもリスト番号が0,1,2と割り振られている
これが全通り入っている
これ作った人はすごい
自分も早く理解したい
'''
#for i in range(0, len(comb)):#i番目のパターンの時を考える。
#  for j in range(0, N-1):#lのリスト番号を読み込み
#    distance += math.sqrt((x[comb[i][j]]-x[comb[i][j+1]])**2 + (y[comb[i][j]]-y[comb[i][j+1]])**2)
'''
各経路の距離を足していき全距離分を経路数
で割れば平均距離が出るので各経路ごとの距離は
不必要と判断されている。
'''
#print(distance/len(comb))
i=0
j=0
#1を選んだとき0,2を選ぶってのがどう実装すべきかわからんかった
#だからここで学ぶ
#2019/1/4参考サイトに見当たらず 　仕方がないのでその場しのぎ
#for i in range(N):
for j in range(3):
        pass
      # dp[i+1][j]=max(dp[i][j]+a_b_c_list[i],dp[i][j],dp[i][j])
#リストを一周するようにすればいいのか

Submission status: Accepted

Solution code:
s=input()

low=set(chr(ord('a')+x) for x in range(26))

if(s[0]=='A' and s[2:-1].count('C')==1 and set(s)-set('AC')<=low):print("AC")
else:print("WA")

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    S = list(input())

    isWA = False
    if S[0] != 'A':
        isWA = True

    if S[2:-1].count('C') != 1:
        isWA = True

    for s in S:
        if s == 'A' or s == 'C':
            continue
        if s.isupper():
            isWA = True

    if isWA:
        print('WA')
    else:
        print('AC')
    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

if S[0] == "A":
    if S[2:-1].count("C") == 1:
        idx = S[2:-1].index("C") + 2
        S = S[1:idx] + S[idx+1:]
        if S == S.lower():
            print("AC")
            exit()

print("WA")

Submission status: Accepted

Solution code:
s=input()
ss=s[2:-1]
flag=1
for i in s:
  if i.isupper() and i!="A" and i!="C":
    flag=0
if s[0]=="A" and ss.count("C")==1 and flag==1:
  print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
s=list(input())
print('AC' if (s[0]=='A') and ('C' in s[2:-1]) and all(i.islower() for i in s if not i in ['A','C']) and (s.count('A')==s.count('C')==1) else 'WA')

Submission status: Accepted

Solution code:
s=list(input())

if s[0]=="A":
    if s[2:-1].count("C")==1:
        if s[1]==s[1].lower() and s[-1]==s[-1].lower():
            print("AC")
            exit()

print("WA")

Submission status: Accepted

Solution code:
s=input()

if s[0] !="A":
    print("WA")
    exit()

cnt=0
for i in range(2,len(s)-1):
   if s[i] == "C":
       cnt+=1
if cnt!=1:
    print("WA")
    exit()

for i in range(1,len(s)):
    if s[i] == "C" and 2<=i<len(s)-1:
        continue
    if not s[i].islower():
        print("WA")
        exit()
print("AC")

Submission status: Accepted

Solution code:
#abc104 b
s=input()
x=s[2:-1]
flag=True
if s[0]!="A" or s[1].isupper() or s[-1].isupper():
    flag=False
cnt=0
for i in range(len(x)):
        if x[i]=="C":
            cnt+=1
        else:
            if x[i].islower()==False:
                flag=False
if cnt!=1:
    flag=False
if flag:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
import re
print("AC" if re.match("^A[a-z]+C[a-z]+$", input()) else "WA")

Submission status: Accepted

Solution code:
S = input()

if S[0] != 'A':
    print("WA")
    exit()
if S[2:-1].count('C') != 1:
    print("WA")
    exit()
if S.replace("A", "").replace("C", "").islower() == False:
    print("WA")
    exit()
print("AC")

Submission status: Accepted

Solution code:
# Problem B - AcCepted

# input process
S = input()

# initialization
is_a_ok = False
is_s_ok = False
s_len = len(S)
count = 0

# count process
for i in range(s_len):
    if i==0 and S[i]=='A':
        is_a_ok = True
        count += 1
        continue

    if i+1>=3 and (i+1)<=(s_len-1):
        if S[i]=='C':
            is_s_ok = True
            count += 1
            continue

    if S[i].isupper():
        count += 1

if count==2 and is_a_ok and is_s_ok:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
import re

S = input()
frag_1 = 0
frag_2 = 0
frag_3 = 0

if S.find("A") == 0:
  frag_1 = 1
if 1 < S.find("C") and S.find("C") < len(S)-1:
  frag_2 = 1
if len(re.findall('[A-Z]', S)) == 2:
  frag_3 = 1

if frag_1 == 1 and frag_2 == 1 and frag_3 == 1:
  print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
a = ord('a')
z = ord('z')
S = input()

ans = 'WA'
if S[0] == 'A':
    if S[2:-1].count('C') == 1:
        for i, c in enumerate(S):
            if i == 0 or c == 'C':
                continue
            else:
                if a <= ord(c) <= z:
                    continue
                else:
                    break
        else:
            ans = 'AC'

print(ans)

Submission status: Accepted

Solution code:
import re
print("WA" if re.match('^A[a-z]+C[a-z]+$',input()) == None else "AC")

Submission status: Accepted

Solution code:
S = input()
T = S[2:-1]
c = 0
U = ''
for t in T:
  if t =='C':
    c+=1
  elif t.isupper():
    print('WA')
    exit()
if S[0]=='A' and c==1 and S[1].islower() and S[-1].islower():
  print('AC')
else:
  print('WA')

Submission status: Accepted

Solution code:
import sys
s = list(input())

if s[0] != "A":
    print("WA"); sys.exit()
else:
    s[0] = "a"
    
if "C" in s[2:-1]:
    s[s[2:-1].index("C") + 2] = "c"
else:
    print("WA"); sys.exit()

if all([i.islower() for i in s]):
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Wed Mar 11 15:11:47 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

from curses.ascii import islower

S = list(ns())
N = len(S)
ccnt = 0
lcnt = 0

for i in range(1, N):
    if S[i] == 'C' and i < N - 1 and i > 1:
        ccnt += 1
    if islower(S[i]):
        lcnt += 1

if lcnt == N - 2 and ccnt == 1 and S[0] == 'A':
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()
s_2 = s[2:-1]
c = 0 
f = 1

if s[0] == 'A': #条件1
    for i in range(len(s_2)): #条件2
        if s_2[i] in 'C':
            f = 1
            for j in range(len(s)):
                if s[j].isupper():
                    c += 1
                
            if c == 2: #条件3(大文字の個数が2の時で判別)
                print('AC')
            else:
                print('WA')
            break
        else:
            f = 0
            pass

else:
    print('WA')
    
if f == 0:
    print('WA')

Submission status: Accepted

Solution code:
s=input()
if s[0]=='A' and s[2:-1].count('C')==1:
    for i in s[1:]:
        if i !='C' and i!=i.lower():
            print('WA')
            exit()
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
S = input()
cnt = 0
if S[0] == "A":
    for i in S[2: len(S) - 1]:
        if i == "C":
            cnt += 1
sr = S.replace("A", "")
src = sr.replace("C", "")
if src.islower() and cnt == 1:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()
if s[0] != 'A':
    print('WA') 
else:
    ii = s.count('C',2,-1)
    if ii != 1:
        print('WA')
    else:
        s_1 = s.lstrip('A')
        s_2 = s_1[1:-2].replace('C','')
        s_1 = s_1[0] + s_1[-1]
        s = s_1 + s_2
        if s.islower() == True:
            print('AC')
        else:
            print('WA')

Submission status: Accepted

Solution code:
S = input()
if S[0] != "A":
  print("WA")
  exit()
elif S[2:-1].count("C") != 1 or S[:2].count("C") != 0 or S[-1:].count("C") != 0:
  print("WA")
  exit()
else:
  S = S[1:].replace("C", "")
  if S.islower():
    print("AC")
  else:
    print("WA")

Submission status: Accepted

Solution code:
s=input()
if s[1]==s[1].upper() or s[-1]==s[-1].upper():
    print("WA")
    exit()

if s[0]=="A":
    count=0
    for i in range(2,len(s)-1):
        if s[i]=="C":
            count+=1
        else:
            if s[i]==s[i].upper():
                print("WA")
                exit()
    if count==1:
        print("AC")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

Solution code:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    s=str(input())
    while True:
        if s[0]!='A':
            print('WA')
            break


        if s[2:-1].count('C')!=1:
            print('WA')
            break
        else:
            s=s[0:s.index('C')]+s[s.index('C')+1:]
            if s==s.capitalize():
                print('AC')
                break
            else:
                print('WA')
                break





resolve()

Submission status: Accepted

Solution code:
S = input()

if S[0] == "A" and "C" in S[2:-1] and S.count("C") == 1 and len([s for s in S if s.isupper()]) == 2:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()
ans = "AC"
if s[0] != "A":
  ans = "WA"
elif s[-1].upper() == s[-1]:
  ans = "WA"
elif s[1].upper() == s[1]:
  ans = "WA"
elif s[2:-1].count("C") != 1:
  ans = "WA"
elif not s[2:].replace("C", "").islower():
  ans = "WA"
  
print(ans)

Submission status: Accepted

Solution code:
s = input()
f = False
f2 = True
c = 0
if s[0] =="A":
    f = True
for x in s[2:len(s)-1]:
    if x == "C":
        c +=1
    else:
        if x.isupper() or s[-1].isupper():
            f2 = False
if not s[1].islower():
    f2 = False
if f and c == 1 and f2:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()
if s[0]=='A':
    cnt = 0
    for t in s[2:-1]:
        if t=='C':
            cnt += 1
            s=s.replace(t,'')
    if cnt==1 and s[1:].islower()==True:
        print('AC')
        exit()
print('WA')

Submission status: Accepted

Solution code:
def l():
    print("WA")
    exit()
s = input()
if s[0] != "A": l()
c = 0
for i in s[2:-1]:
    if i == "C":
        c += 1
if c != 1: l()
print("AC") if s[1].islower() and s[-1].islower() else l()

Submission status: Accepted

Solution code:
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):  # リストに重複した要素があるか判定（要素にリストがある場合）
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


s = list(map(str, input()))
# print(s)
for i in range(-1, 2):
    #print(i, s[i])
    if s[i] == 'C':
        print('WA')
        exit()

for c in s[1:]:
    if c == 'A':
        print('WA')
        exit()


def cnt(s):
    a = 0
    for i in range(2, len(s)-1):
        # print(i, s[i])
        if s[i] == 'C':
            a += 1
    if a == 1:
        return True
    else:
        return False


def remove(s):
    s.remove('A')
    s.remove('C')
    return s


def func(s):
    if s[0] == 'A':
        pass
    else:
        return False
    if cnt(s):
        pass
    else:
        return False
    return True


if func(s):
    s = remove(s)
    aa = 0
    for i in range(len(s)):
        if s[i].islower():
            aa += 1
    if aa == len(s):
        print('AC')
        exit()
print('WA')

Submission status: Accepted

Solution code:
s = input()
ok=True
if s[0]!='A': ok=False
n = s.find('C')
if not 2<=n<len(s)-1: ok=False
for i in range(len(s)):
    if i!=0 and i!=n and s[i].isupper(): 
        ok=False
print('AC'if ok else 'WA')

Submission status: Accepted

Solution code:
s=input()
cnt=0
if s[0] != 'A':
    print('WA')
    exit()
if s[2:len(s)-1].count('C') != 1:
    print('WA')
    exit()
else:
    for i in range(1,len(s)):
        if s[i]=='C':
            continue
        if s[i].isupper():
            print('WA')
            exit()

print('AC')

Submission status: Accepted

Solution code:
S = input()
ans = "WA"
if S[0] == "A":
    tmp = S[2:len(S)-1]
    if tmp.count("C") == 1:
        c = tmp.index("C")
        count = 0
        for i in range(1,len(S)):
            tmp2 = S[i]
            if tmp2.islower():
                count += 1
        if count == len(S) - 2:
            ans = "AC"
print(ans)

Submission status: Accepted

Solution code:
S = input()
flg1 = flg2 = flg3 = True
if not S[0] == 'A':
    flg1 = False
if not S.count('C', 2, -1) == 1:
    flg2 = False
j = len(S) + 1
for i in range(len(S)):
    if S[i] == 'C':
        j = i
for i in range(len(S)):
    if i == 0 or i == j:
        continue
    else:
        if S[i].islower() == False:
            flg3 = False
flg = flg1 * flg2 * flg3
print('AC' if flg else 'WA')

Submission status: Accepted

Solution code:
S = input()
if S[0] != 'A':
    print('WA')
    exit()
c_count = 0
for i in range(2,len(S)-1):
    if S[i] == 'C':
        c_count += 1
if c_count != 1:
    print('WA')
    exit()
for i in range(1,len(S)):
    if S[i] == 'C':
        continue
    if S[i].isupper():
        print('WA')
        exit()
print('AC')

Submission status: Accepted

Solution code:
#ABC104

s = input()

if s[0] == "A" and s[2:-1].count("C") == 1:
    k = s[2:-1].index("C") + 2
    
    if str.islower(s[1:k] + s[k+1:]):
        print("AC")
    else:
        print("WA")
else:
    
    print("WA")

Submission status: Accepted

Solution code:
s = list(input())

a = False
c = False
small = False
for i in range(len(s)):
    if i == 0 and s[i] == "A":
        a = True
    elif a == True and i >= 2 and i < len(s) - 1 and s[i] == "C" and c == False:
        c = True
    elif s[i] >= "a" and s[i] <= "z":
        small = True
    else:
        small = False
        break

if a == True and c == True and small == True:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()

LETTERS_A = "BCDEFGHIJKLMNOPQRSTUVWXYZ"
LETTERS_C = "ABDEFGHIJKLMNOPQRSTUVWXYZ"
LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
count = 0
is_ok = True
c1, c2 = False, False
for i in range(len(s)):
    if i == 0:
        c1 = (s[i] == "A")
        if s[i] in LETTERS_A:
            is_ok = False
    elif (2 <= i) and (i <= len(s)-2):
        if s[i] == "C":
            count += 1
        if s[i] in LETTERS_C:
            is_ok = False
    elif s[i] in LETTERS:
        is_ok = False
        
c2 = (count == 1)
if c1 and c2 and is_ok:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
import sys
s = list(input())
if s[0] != "A":
    print("WA")
    sys.exit()
c = 0
for i in range(2,len(s)-1):
    if s[i] == "C":
        c += 1
if c != 1:
    print("WA")
    sys.exit()
c = 0
for i in range(len(s)):
    if ord(s[i]) >= 65 and ord(s[i]) <= 90:
        c += 1
if c == 2:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = list(input())
j= 2
count = 0
if not s[0] == 'A':
    print('WA')
    exit()

for i in s[2:-1]:
    if i == 'C':
        count += 1
        tmp = j
    j += 1
if not count == 1:
    print('WA')
    exit()

del s[0]
del s[tmp-1]
s = ''.join(s)

if s.islower():
    print('AC')
    exit()

print('WA')

Submission status: Accepted

Solution code:
s = list(input())
if s[0] == "A" and "C" in s[2:-1]:
    s.remove("A")
    s.remove("C")
    for i in s:
        if i.isupper():
            print("WA")
            exit()
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s=input()
if s[0]=="A" and "C" in s[2:-1] and s[1:].replace("C","",1).islower():
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s=input()

n = len(s)

countC = 0

alf = [chr(ord('a') + i) for i in range(26)]

for i in range(n):
    #print(i)
    if i == 0 and s[i] != 'A':
        print('WA')
        exit()
    elif i == 0 and s[i] == 'A':
        continue
    elif s[i] == 'C' and 1 < i and i < n-1:
        countC += 1
    elif s[i] in alf:
        continue
    else:
        print('WA')
        exit()
    
if countC == 1:
    print('AC')
else:
    print('WA')