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.

Solution (Python):
import sys
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    S = input()
    flag = True
    if S[0] != 'A' or S[2:-1].count('C') != 1:
        flag = False
    for i in range(len(S)):
        if S[i] not in 'ACabcdefghijklmnopqrstuvwxyz':
            flag = False
            break
    print('AC' if flag else 'WA')
if __name__ == '__main__':
    main()

Solution (Python):
s = input()

c1= c2 = 0
for i in s[2:]:
    if i == 'C':
        c1 += 1
    else:
        if i!=i.lower():
            c2 +=1
if s[0] == 'A' and s[1] == s[1].lower() and c1==1 and c2==0 and s[-1] != 'C':
    print('AC')
else:
    print('WA')

Solution (Python):
s = input()
if s[0] != 'A':
  print('WA')
  exit()
sho = ord('a')
ok = 0
for i in s[2: len(s) - 1]:
  if ord(i) < sho:
    if ord(i) == ord("C"):
      ok += 1
    else:
      print("WA")
      exit()
if ord(s[1]) < sho or ord(s[len(s) - 1]) < sho:
  print("WA")
  exit()
if ok == 1:
  print("AC")
else:
  print("WA")

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

Solution (Python):
import sys
import bisect
import heapq  

inf = 10 ** 15
mod = 10 ** 9 + 7

s = input()
length = len(s)
if s[0] == 'A':
    tmp = s[2:length-1]
    count = 0
    if s[1].isupper():
        print('WA')
        sys.exit()
    for c in tmp:
        if c.isupper():
            if c == 'C':
                count += 1
            else:
                print('WA')
                sys.exit()
    if count == 1 and s[-1].islower():
        print('AC')
    else:
        print('WA')

else:
    print('WA')

Solution (Python):
S = input()
c1 = S[0] == "A"
c2 = S[2:-1].count("C") == 1
if c1 and c2:
    cnt = 0
    for s in S:
        if s.isupper():
           cnt += 1
    if cnt == 2:
        print("AC")
    else:print("WA")
else:
    print("WA")

Solution (Python):
S = list(input())
if S[0] != 'A':
    print('WA')
    exit()
if len([s for s in S[2:-1] if s == 'C']) != 1:
    print('WA')
    exit()
SL = [s for s in S if s not in ['A', 'C']]
if not all([sl.islower() for sl in SL]) or len(SL) + 2 != len(S):
    print('WA')
    exit()
print('AC')

Solution (Python):
s = input()

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

Solution (Python):
s = input()

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

c = 0

for i in range(1, len(s)):
    num = ord(s[i])
    if num >= 97:
        continue
    elif 2 <= i <= len(s)-2 and num == 67:
        c += 1
    else:
        print("WA")
        exit()

if c == 1:
    print("AC")
else:
    print("WA")

Solution (Python):
import sys
s=input()
c=0
if s[0]=="A":
    for i in range(2,len(s)-1):
        if s[i]=="C":
            c+=1
            C_nobasyo=i
    
    if c==1:
        text=s
        
        text=text.replace("C","")
        text=text.lstrip("A")
        
        if text.islower()==True:
            print("AC")
        else:
            print("WA")
            sys.exit()
    else:
        print("WA")
        sys.exit()
else:
    print("WA")

Solution (Python):
s = str(input())
count = 0
ansFlg = 0

if s[0] == "A":
    s = "a" + s[1:]
    ansFlg += 1

for i in range(2, len(s)-1):
    if s[i] == "C":
        s = s[:i] + "c" + s[i + 1:]
        count += 1
if count == 1:
    ansFlg += 1

if s.islower():
    ansFlg += 1

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

Solution (Python):
s=str(input())
temp=list(s)
if temp[0]=="A":
  del temp[len(s)-1]
  del temp[1]
  del temp[0]
  c=temp.count("C")
  if c==1:
    s=s.replace("A","")
    s=s.replace("C","")
    if s.islower()==True:
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")

Solution (Python):
import re;print("AC" if re.fullmatch("A[a-z]+C[a-z]+", input()) is not None else "WA")

Solution (Python):
s = input()
flag = 1
if s[0] == "A":
    tmp = s[2:-1].find("C")
    if tmp >= 0:
        tmp2 = s[1]
        tmp2 += s[2:tmp+2]
        tmp2 += s[tmp+3:]
        if tmp2 == tmp2.lower():
            flag = 0
if flag == 0:
    print("AC")
else:
    print("WA")

Solution (Python):

s = input()


s1 = s[0]


s2 = s[2:-1]


s = s.replace('A','')
s = s.replace('C','')



t = s.lower()

if(s1 == 'A' and s2.count('C') == 1 and t == s):    
    print('AC')
else:
    print('WA')

Solution (Python):
S = input()
 
 
if S[0] != "A":
    print("WA")
 
elif "C" in S:
    a = S.index("C")
 
    if 2 <= a <= len(S)-2:
        S = S.replace("A", "", 1).replace("C", "", 1)
        
        if S.islower():
            print("AC")
        
        else:
            print("WA")
 
    else:
        print("WA")
 
else:
    print("WA")

Solution (Python):
import sys
s = input()

l = len(s)
if s[0] != "A":
    print("WA")
    sys.exit()
ss =  s[2:l-1]
if ss.count("C") != 1:
    print("WA")
    sys.exit()

cidx = ss.find("C")+2
sss = s[1:cidx]+s[cidx+1:]
if sss.islower():
    print("AC")
    sys.exit()

print("WA")

Solution (Python):
S = input()

ans_1 = S[0]=="A"
ans_2 = S[2:-1].count("C")==1
S = S[1:].replace("C", "")
ans_3 = S.islower()

print("AC") if ans_1 & ans_2 & ans_3 else print("WA")

Solution (Python):
def main():
    s = input()
    if s[0] == "A" and s.count("C", 2, -1)==1:
        s = s.replace("A", "")
        s = s.replace("C", "")
        if s.islower() == True:
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
    
if __name__ == '__main__':
    main()

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

Solution (Python):
s = input()
if s[0] == "A":
    x = s.find("C")
    if 2<=x and x != len(s)-1:
        s = [i for i in s]
        s[0]="a"
        s[x]="c"
        s = "".join(s)
        if s.islower():
            print("AC")
            exit()
print("WA")

Solution (Python):
S = input()
flag = True
cflag = False
for i, c in enumerate(S):
    if i == 0:
        if c == "A":
            continue
        else:
            flag = False
            break

    if c == "C" and 2 <= i < len(S)-1:
        if cflag:
            flag = False
        cflag = True

    elif not (97 <= ord(c) <= 122):
        flag = False


if flag and cflag:
    print("AC")
else:
    print("WA")

Solution (Python):
def inpl(): return list(map(int, input().split()))
S = input()
ok = False
if S[0] == "A" and S[2:-1].count("C") == 1:
    u = 0
    for s in S[1:]:
        u += s.isupper()
    if u == 1:
        ok = True
if (ok):
    print("AC")
else:
    print("WA")

Solution (Python):
S = input()
ans = "AC"

if S[0] != "A":
    ans = "WA"

cnt = 0

for i in range(1, len(S)):
    s = S[i]
    if s.isupper():
        if i == 1 or i == len(S) - 1 or s != "C":
            ans = "WA"
        cnt += 1

if cnt != 1:
    ans = "WA"

print(ans)

Solution (Python):
import sys

class alphabet: 
    def __init__(self, capitalize):
        self.num = dict() 
        self.abc = ("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")
        if capitalize: 
            for i in range(26): self.abc[i] = self.abc[i].upper()
        for i, a in enumerate(self.abc): self.num[a] = i


def solve():
    input = sys.stdin.readline
    S = input().strip("\n")
    N = len(S)
    AB = alphabet(False)

    if S[0] != "A": print("WA")
    else:
        if S[1] not in AB.abc: print("WA")
        else:
            cCount = 0
            possible = True
            for i in range(2, N-1):
                if S[i] not in AB.abc:
                    if S[i] == "C": cCount += 1
                    else: possible = False
            if not possible: print("WA")
            elif cCount != 1: print("WA")
            else:
                if S[N-1] not in AB.abc: print("WA")
                else: print("AC")

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
s = input()
flag = True
flag = flag and s[0] == 'A'
Ccount = 0
for i in range(1,len(s)):
  if ord('a') <= ord(s[i]) and ord(s[i]) <= ord('z'): continue
  if s[i] == 'C' and 2 <= i and i <= len(s)-2:
    Ccount += 1
  else:
    flag = False
print("AC" if flag and Ccount == 1 else "WA")

Solution (Python):
s = input()
s1 = s[0]
s2 = s[2:-1]
s = s.replace('A','')
s = s.replace('C','')
t = s.lower()
if(s1 == 'A' and s2.count('C') == 1 and t == s):
    print('AC')
else:
    print('WA')

Solution (Python):
import sys
input = sys.stdin.readline

S = input().rstrip()
S32 = S[2:-1]
trimed_S = S32.replace('C', '', 1)
ac_cut_S = S.replace('A', '', 1).replace('C', '', 1)

ans = 'AC'
if S[0] != 'A':
  ans = 'WA'
elif (not ac_cut_S.islower()) or len(S32) - len(trimed_S) != 1:
  ans = 'WA'

print(ans)

Solution (Python):
s = input()
s_len = len(s)
if s[0] == "A":
    if s[2:s_len-1].count("C") == 1:
        dum = s.index("C")
        s = s[1:dum]+s[dum+1:s_len]
        if s == s.lower():
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Solution (Python):
s=input()
a=s.lower()
l=len(s)
count=0
dif=0

if s[0]=='A':
  for i in range(2,l-1):
    if s[i]=='C':
      count+=1
  if count==1:
    for i in range(1,l):
      if s[i]!=a[i]:
        dif+=1
    if dif==1:
      print('AC')
      exit()
print('WA')

Solution (Python):
s=input()
yn=0
if s[0]=="A" and ord(s[1])>95 and ord(s[len(s)-1])>95 and s.count("C")==1:
    for i in range(len(s)-3):
        if s[i+2]!="C" and ord(s[i+2])<92:
            yn=1
    if yn==1:
        print("WA")
    else:
        print("AC")
else:
    print("WA")

Solution (Python):
S = input()
NG = ['B','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
ans = 'AC'
if S[2:-1].count('C') != 1:
  ans = 'WA'
for i in range(len(S)):
  if i == 0 and S[0] != 'A':
    ans = 'WA'
    break
  elif i == S[2:-1].find('C'):
    continue
  elif S[i] in NG:
    ans = 'WA'
print(ans)

Solution (Python):

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

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

Solution (Python):
import re
s=input()
S=list(s)

if S[0]=="A" and S[2:-1].count('C')==1 and len(S)-len(re.findall('[a-z]',s))==2:
  print('AC')
else:
  print('WA')

Solution (Python):

"""
Created on Wed May 13 16:16:15 2020

@author: shinba
"""
import sys

s = list(input())

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

t = s[1:len(s)-1]

if t.count("C") != 1:
    print("WA")
    sys.exit()
else:
    t.remove("C")

t.append(s[-1])
t.insert(0,s[0])

if "".join(t) == "".join(t).lower():
    print("AC")
else:
    print("WA")

Solution (Python):
s = input()
ans = 'WA'
if s[0] == 'A':
  s = s[1:]
  a = s[1:-1]
  if a.count('C') == 1:
    s = s.replace('C' , '' , 1)
    if s.islower():
      ans = 'AC'
print(ans)

Solution (Python):
S = input()
if S[0] == "A":
    count = 0
    S2 = S[2:-1]
    for i in S2:
        if i == "C":
            count += 1
    if count == 1:
        S3 = S[1:].replace("C","")
        if S3.islower():
            print("AC")
            exit()
print("WA")

Solution (Python):

s = input()
ans = "AC"
if s[0] != 'A':
    ans = "WA"
s = list(s)
s[0] = 'a'
f = 0
for i in range(2,len(s)-1):
    if s[i] == "C":
        if f:
            ans = "WA"
        else:
            f = 1
            s[i] = "c"

if not f:
    ans = "WA"
for si in s:
    if si not in "abcdefghijklmnopqrstuvwxyz":
        ans = "WA"
print(ans)

Solution (Python):
S = list(input())

if S[0] != 'A':
    print('WA')
elif S[2:-1].count('C') != 1:
    print('WA')
else:
    S = list(S[1:])
    S.remove('C')
    S = ''.join(S)
    if S.islower():
        print('AC')
    else:
        print('WA')

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

Solution (Python):
import sys
s=input()
cnt=0
if s[0]!='A':
    print('WA')
elif s[1].isupper():
    print('WA')
elif s[-1].isupper():
    print('WA')
else:
    for i in range(2,len(s)-1):
        if s[i]=='C':
            cnt+=1
        else:
            if s[i].isupper():
                print('WA')
                sys.exit()
    if cnt==1:
        print('AC')
    else:
        print('WA')

Solution (Python):
import re

S = input()

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

if S.count("C") != 1:
    print("WA")
    exit()

if S[1].islower() and S[-1].islower() and len(re.findall('[a-z]', S)) == len(S)-2:
    print("AC")
else:
    print("WA")

Solution (Python):


def main():
    S = input()

    flag1 = False
    if S[0] == 'A':
        flag1 = True
    
    flag2 = False
    cnt = 0
    for i in S[2:-1]:
        if i == 'C':
            cnt += 1
    if cnt == 1:
        flag2 = True
    
    flag3 = False
    cnt = 0
    for i in S:
        if i.isupper():
            cnt += 1
    if cnt == 2:
        flag3 = True
        

    if flag1 == flag2 == flag3 == True:
        print('AC')
    else:
        print('WA')


main()

Solution (Python):
A= input()
if A[0]=="A" and A[2:-1].count("C")==1:
    pass
else:
    print("WA")
    exit()
B=A[1:]
B=B.replace("C","")
if B.islower()==True:
    print("AC")
else:
    print("WA")

Solution (Python):
import sys
S = input()
if S[0] != 'A':
    print('WA')
    sys.exit()
    
n = len(S)
ct = 0
for i in range(1, n):
    if S[i].islower() == False:
        if i == 1 or i == n - 1 or S[i] != 'C':
            print('WA')
            sys.exit()
        ct += 1
if ct == 1:
    print('AC')
else:
    print('WA')

Solution (Python):
s = input()
bl = True
for i in range(len(s)):
    if i == 0:
        if s[i] != "A":
            print("WA")
            exit()
    elif 2 <= i <= len(s) - 2:
        if s[i] == "C" and bl:
            bl = False
        else:
            if not s[i].islower():
                print("WA")
                exit()
    else:
        if not s[i].islower():
            print("WA")
            exit()
if not bl:
    print("AC")
else:
    print("WA")

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

from collections import Counter
def resolve():
    S=input()
    tmp=(S[0]=="A")
    f=0
    a=""
    for i in range(1,len(S)):
        if S[i]=="C":
            if i>=2 and i<len(S)-1:
                f=1
                tmp+=1
            else:break
        else:a+=S[i]        
    tmp+=(a.islower())
    print(["WA","AC"][tmp==3])
    
    

resolve()

Solution (Python):
s = input()
if s[0] == "A" and s[2 : - 1].count("C") == 1:
    t = s[1:].replace("C", "c")
    if t == t.lower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")

Solution (Python):
S = input()

Cflag = 0
if S[0] == 'A':
    for i in range(1, len(S)):
        if S[i] == 'C' and Cflag == 0 and 2 <= i < len(S)-1:
            Cflag = 1
        elif S[i] == 'C' and Cflag != 0:
            print('WA')
            exit()
        elif ord(S[i]) < 97:
            print('WA')
            exit()
    if Cflag == 1:
        print('AC')
    else:
        print('WA')
else:
    print('WA')

Solution (Python):
S = input()
count = 0
flag = False
if S[0] == "A":
    
    tmp = S[2:-1]
    lower = S[1:]
    for i in range(len(tmp)):
        if tmp[i] == "C":
            count += 1
    if count == 1:
        tmpS = S.replace("A","a")
        tmpSS = tmpS.replace("C","c")
        if tmpSS.islower():
            flag = True

if flag:
    print("AC")
else:
    print("WA")

Solution (Python):
import fileinput

s = list(input())

if s[0] != "A" or s[1].isupper() or s[len(s) - 1].isupper():
    print("WA")
    exit()

cc = False
for i in range(2, len(s) - 1):
    if s[i] == "C" and not cc:
        cc = True
        continue
    if s[i] == "C" and cc:
        print("WA")
        exit()
    if s[i].isupper() and s[i] != "C":
        print("WA")
        exit()

if cc:
    print("AC")
else:
    print("WA")

Solution (Python):
s = input().strip()
list_s = list(s)


def judge(s):
    if s[0] != 'A':
        return False
    list_s[0] = 'a'
    count = 0
    for idx, c in enumerate(s):
        if 2 <= idx and idx <= len(s) - 2 and c == 'C':
            count += 1
            list_s[idx] = 'c'

    if count != 1:
        return False

    return ''.join(list_s) == s.lower()


if judge(s):
    print('AC')
else:
    print('WA')

Solution (Python):
s = list(input())

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

frag = True
for i in range(2,len(s)-1):
  if s[i]=='C':
    frag = False
    del s[i]
    break

if frag:
  print("WA")
  exit()
  
if not "".join(s[1:]).islower():
  print("WA")
else:
  print("AC")

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    def main():
        if s[0] != 'A' or s[2:-1].count('C') != 1:
            return 'WA'
        for i in s[2:-1]:
                if i != 'C' and i.isupper():
                    return 'WA'
        if s[1].isupper() or s[-1].isupper():
            return 'WA'
        return 'AC'
    print(main())
resolve()

Solution (Python):
from re import fullmatch
s = input()
print("AC" if fullmatch("A[a-z]+C[a-z]+", s) is not None else "WA")

Solution (Python):
import re
s = input()

if s[0] == "A":
  if "C" in s[2:len(s)-1] and s[2:len(s)-1].count("C") == 1:
    rep = re.sub(r"[A,C]", "", s)
    if rep.islower():
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")

Solution (Python):

S = input()

ans = "AC"

if S[0] != 'A' or S[2:-1].count('C') != 1 or S[-1] == 'C' or S[1] == 'C':
  ans = "WA"
for i in range(1, len(S)):
  if S[i].isupper() and S[i] != 'C':
    ans = "WA"
print(ans)

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

S = input()
ans = "AC"
if S[0] != 'A' or S[2:-1].count('C') != 1 or S[-1] == 'C' or S[1] == 'C':
  ans = "WA"
for i in range(1, len(S)):
  if S[i].isupper() == True and S[i] != 'C':
    ans = "WA"
print(ans)

Solution (Python):
S = input()
ans = 'AC'
if S[0] != 'A':
    ans = 'WA'
if S[2:][:-1].count('C') != 1:
    ans = 'WA'
if (S.count('A') != 1) or (S.count('C') != 1) or (not S.replace('A','a').replace('C','c').islower()):
    ans = 'WA'
print(ans)

Solution (Python):
s = input()

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

Solution (Python):
S = input()
flag = True
if S[0] != 'A':
  flag = False
elif S[2:-1].count('C') != 1:
  flag = False
else:
  for s in S[1:]:
    if s not in 'abcdefghijklmnopqrstuvwxyzC':
      flag = False
      break
if flag:
    print("AC")
else:
    print("WA")

Solution (Python):
S = list(input())
A_check = []
C_check = []
lower_check = []

for i in range(len(S)):
    if S[i] == 'A':
        A_check.append(i)
    
    if S[i] == 'C':
        C_check.append(i)
    
    if S[i].islower():
        lower_check.append(i)
        

if len(A_check) != 1 or len(C_check) != 1 or len(lower_check) != (len(S) - 2):
    print('WA')
elif A_check[0] != 0 or C_check[0] == len(S) - 1 or C_check[0] < 2:
    print('WA')
else:
    print('AC')

Solution (Python):
S = input()
length = len(S)

match = True
if S[0] != "A":
    match = False
elif S[2:length-1].count("C") != 1:
    match = False

for i in S:
    if i not in ["A", "C"] and i.isupper():
        match = False

print("AC" if match else "WA")

Solution (Python):
S = list(input())

if S[0] != "A":
  print("WA")
elif S[2:-1].count("C") != 1:
  print("WA")
elif sum([s.islower() for s in S])+2 != len(S):
  print("WA")
else:
  print("AC")

Solution (Python):
def main():
    S = input()

    if S[0] != 'A':
        print('WA')
        exit()
    S = 'a'+S[1:]
    if S.count('C', 2, len(S)-1) != 1:
        print('WA')
        exit()
    tmp = S[2:len(S)-1].find('C') + 2
    S = S[:tmp] + 'c' + S[tmp+1:]
    if S != S.lower():
        print('WA')
        exit()
    print('AC')


if __name__ == "__main__":
    main()

Solution (Python):
S = input()
flag = True

if S[0] != "A":
  flag = False
elif S[2:-1].count("C") != 1:
  flag = False
else:
  tmp = ""
  for s in S:
    if s != "A" and s != "C":
      tmp += s
  if not tmp.islower() or len(tmp) != len(S) - 2:
    flag = False
print("AC" if flag else "WA")

Solution (Python):
S = input()
ans = 'AC'

if S[0] != 'A':
    ans = 'WA'

cnt = 0

for i in range(1, len(S)):
    s = S[i]
    if s.isupper():
        if i == 1 or i == len(S) - 1 or s != 'C':
            ans = 'WA'
        cnt += 1

if cnt != 1:
    ans = 'WA'

print(ans)

Solution (Python):
s = input()
if not s[0]=="A":
  print("WA")
elif not s[1].islower():
  print("WA")
else:
  cnC = 0
  for i in range(2,len(s)-1):
    if s[i]=="C":
      cnC += 1
    elif s[i].isupper():
      print("WA")
      quit()
  if cnC==1 and s[len(s)-1].islower():
    print("AC")
  else:
    print("WA")

Solution (Python):
S = list(input())
c = S[2:-1].count('C')
u = 0
for char in S:
  if char.isupper():
    u += 1

if S[0]=='A' and c == 1 and u == 2:
  print('AC')
else:
  print('WA')

Solution (Python):
s = input()

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

cnt = 0
for c in s[2:-1]:
    if c == 'C':
        cnt += 1
if cnt != 1:
    print('WA')
    exit()

for c in s:
    if c == 'A' or c == 'C':
        continue
    if c.isupper():
        print('WA')
        exit()
print('AC')

Solution (Python):

import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi

S = rs()
N = len(S)
ans = 'AC'
if S[0] != 'A' or S[2:-1].count('C') != 1:
    ans = 'WA'
for i in range(N):
    if not S[i] in ascii_lowercase:
        if not (i == 0 and S[i] == 'A') and not (2 <= i < N - 1 and S[i] == 'C'):
            ans = 'WA'
print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        s=input()
        if s[0] == 'A' and s[2:-1].count('C') == 1:
            for i in s[2:-1]:
                if i != 'C' and i.isupper():
                    return 'WA'
            if s[1].isupper() or s[-1].isupper():
                return 'WA'
            return 'AC'
        else:
            return 'WA'
    print(main())
resolve()

Solution (Python):
s = input()
if s[0] == "A" and s[2:-1].count("C") == 1:
    count = 0
    for c in s:
        if c.capitalize() == c:
            count += 1
    if count != 2:
        print("WA")
    else:
        print("AC")
else:
    print("WA")

Solution (Python):
s = input()
c = 0
if s[0] == 'A':
  c += 1
hoge = s[2:-1]
a = hoge.count('C')
if a == 1:
  c += 1
b = s.replace("A","")
d = b.replace('C','')
e = d.islower()
if e == True:
  c += 1
if c == 3:
  print('AC')
else:
  print('WA')

Solution (Python):


import sys






















def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    s = input()
    if s[0] == 'A' and s[2:-1].count('C') == 1:
        for char in s:
            if not (char == 'A' or char == 'C' or char.islower()):
                break
        else:
            print('AC')
            exit()
    print('WA')



if __name__ == "__main__":
    main()

Solution (Python):
def main():
    S = input()
    n = len(S)
    condA = False
    condB = False
    condC = True
    countC = 0
    for i in range(n):
        if(i == 0 and S[i] == "A"):
            condA = True
        elif(i >= 2 and i <= n-2):
            if(S[i] == "C"):
                countC += 1
        else:
            condC = condC and S[i].islower()
    if(countC == 1):
        condB = True

    if(condA and condB and condC):
        print("AC")
    else:
        print("WA")

            

main()

Solution (Python):
s = input()


def check(w):
    if w[0] != 'A':
        return False
    n = len(w)
    count = 0
    for a in range(2, n-1):
        if w[a] == 'C':
            count += 1
    if count != 1:
        return False
    upper = 0
    for a in range(0, n):
        if w[a] >= 'A' and w[a] <= 'Z':
            upper += 1

    if upper != 2:
        return False
    return True


if check(s):
    print('AC')
else:
    print('WA')

Solution (Python):
import re

s = input()


def isAlpha(value):
    """
    半角英字チェック
    :param value: チェック対象の文字列
    :rtype: チェック対象文字列が、全て半角英字の場合 True
    """
    return re.fullmatch(r"^A([a-z]+)C([a-z]+)", value) is not None


if isAlpha(s):
    print('AC')
else:
    print('WA')

Solution (Python):
s = input()
if s[0] == "A":
    if s[2:-1].count("C") == 1:
        a = s.replace("A","")
        a = a.replace("C","")
        if a == a.lower():
            print("AC")
            exit()
print("WA")

Solution (Python):
def f(s):
  u = 0
  for c in s:
    if c.isupper():
      u += 1
  return u == 1
s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1 and f(s[1:]):
  print('AC')
else:
  print('WA')

Solution (Python):
import sys
input = sys.stdin.readline


def main():
    S = input().rstrip()

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


if __name__ == "__main__":
    main()

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

Solution (Python):


s = input()

if s[0] != "A":
    print("WA")
    exit()
if s[2:-1].count("C") != 1:
    print("WA")
    exit()

if s.replace("A","a").replace("C","c").islower():
    print("AC")
else:
    print("WA")

Solution (Python):






def main():
    S = input()
    N = len(S)

    head = S[0]
    
    if head == "A":
        c_cnt = 0
        c_i = None
        for i in range(2, N-1):
            if S[i] == "C":
                c_cnt += 1
                c_i = i
        if c_cnt != 1:
            return "WA"
        for i in range(N):
            if i in [0, c_i]:
                continue
            if 65 <= ord(S[i]) <= 90:
                return "WA"
        return "AC"
    else:
        return "WA"


print(main())

Solution (Python):
import sys
S=input()
first=S[0]
second=S[1]
last=S[len(S)-1]
cnt=0
moji=[i for i in "abcdefghijklmnopqrstuvwxyz"]


if first=="A":
  for i in range(2,len(S)-1):
  
    if S[i]=="C":
      cnt+=1
    else:
      if (S[i] in moji)==False:
        print("WA")
        sys.exit()

  if cnt==1 and ((last in moji)==True) and ((second in moji)==True):
    print("AC")
  else:
    print("WA")
        
else:
  print("WA")

Solution (Python):
s = input()
if s[0]!='A' or s[2:-1].count('C')!=1:
    print('WA')    
else:
    cnt = 0
    for i in s:
        if i<'a' or 'z'<i:
            cnt += 1
    if cnt==2:
        print('AC')
    else:
        print('WA')

Solution (Python):
import copy
s=list(input())
if s[0]=='A' and 'C' in s[2:len(s)] :
  t=copy.copy(s)
  s.remove('A')
  s.remove('C')
  result=''.join(s)
  if len(s)==len(t)-2 and result.islower()==True and t[-1]!='C':
    print('AC')
  else:
    print('WA')
    
else:
  print('WA')

Solution (Python):
s = input()
ans = 'AC'
if s[0] != 'A':
    ans = 'WA'
elif s[2:-1].count('C') != 1:
    ans = 'WA'
elif s[1:].replace('C','').lower() != s[1:].replace('C',''):
    ans = 'WA'
print(ans)

Solution (Python):

S = input()

if not S[0] == 'A':
    print('WA')
    exit()

if not S.count('C', 2, -1) == 1:
    print('WA')
    exit()

for i in S:
    if i == 'A' or i == 'C':
        pass
    else:
        if not i.islower():
            print('WA')
            exit()


print('AC')

Solution (Python):
S = input()
if S[0] == 'A' and S[2:-1].count('C') == 1:
    S = S[1] + S[2:-1].replace('C', '') + S[-1]
    if S == S.lower():
        print('AC')
        exit()
print('WA')

Solution (Python):
s = list(input())
ans = 1
sw = 0
for i in range(len(s)):
    if i == 0 :
        if s[0] !="A":
            ans = 0
    elif 2 <= i <= len(s)-2 and s[i] == "C":
        sw += 1
    else:
        if not(97<= ord(s[i]) <= 122):
            ans = 0
if ans == 1 and sw == 1:
    print("AC")
else:
    print("WA")