peterverebics/CodeNet_Python_118 huggingface dataset:
s = list(map(int,list(input())))
li = [2,3,4,5,6,7,8,9]
ans = 1
for i in range(len(s)):
    if s[i] in li:
        ans = s[i]
        break
print(ans)
S=input()
k=int(input())
for s in S:
    if s!='1':
        print(s)
        exit()
S = input()
K = int(input())

if K > 100:
    print(S[0])
else:
    for i in range(K):
        if S[i] != "1":
            print(S[i])
            break
        if i == K-1:
            print(S[K-1])
S = input()
K = int(input())

for i in range(K):
    if S[i] != "1":
        print(S[i])
        break
s = input()
k = int(input())
m = 0
for i in s:
  if i==1:
    m += 1
  else:
    break
if m>=k:
  print(1)
else:
  for i in s:
    if i!="1":
      print(i)
      break
    else:
      continue
s = input()
k = int(input())

ans = 1
for i in range(len(s)):
    if s[i] != '1':
        ans = int(s[i])
        break
print(ans)
s=input()
k=int(input())

if s[0]!='1':
  print(s[0])
else:
  if k==1:
    print(1)
  else:
    print(s[1])
s = input()
input()

if s[0] != '1':
  print(s[0])
else:
  for e in s:
    if e != '1':
      print(e)
      break
S = input()
K = int(input())
ans = ""

for i in range(len(S)):
  if int(S[i]) == 1:
    continue
  else:
    if i+1 <= K:
      ans = S[i]
      break
    else:
      ans = 1
      break
print(ans)
def main(s, k):
    for i in s:
        if i != "1":
            print(i)
            return
    
    print(1)

if __name__ == "__main__":
    s = input()
    k = int(input())

    main(s, k)
def submit():
    s = str(input())
    k = int(input())

    for i, c in enumerate(s):
        if c != "1":
            if i + 1 > k:
                print("1")
                return
            else:
                print(c)
                return
            

if __name__ == "__main__":
    submit()
s = input()
k = int(input())

if k == 1:
    print(int(s[0]))
elif s[0] == "1":
    print(int(s[1]))
else:
    print(int(s[0]))
s = input()

k = int(input())

tyou = 5000000000000000


ichi = True
for i in s:
    if int(i) != 1:
        ichi = False


if k == 1 or ichi :
    print(s[0])
else:
    for i in range(len(s)):
        if int(s[i]) == 1:
            pass
        else:
            print(s[i])
            exit()
S=input()
K=int(input())
i=0
while S[i]!='1' and K<i+1:
  i+=1
else:
  i=0
print(S[i])
# https://atcoder.jp/contests/abc106/tasks/abc106_c

s = input()[:-1]
k = int(input())

for i in range(len(s)):
    if s[i] != '1':
        print(s[i])
        break
else:
    print('1')
A = str(input())
B = int(input())
count = 0

for i in range(len(A)):
    if A[i] == "1":
        count += 1
    else:
        if B <= count:
            print(1)
            break
        else:
            print(A[i])
            break
S = input()
K = int(input())

if S[0] != 1:
  print(S[0])
elif S[0] == 1 and K > 1:
  print(S[1])
else:
  print(1)
S = input()
K = int(input())
one = 0
for i in range(len(S)):
  tmp = S[i]
  if(tmp == "1"):
    one += 1
  else:
    ans = tmp
    if(one >= K):
      print("1")
      exit()
    else:
      print(str(ans))
      exit()
#abc106 c
s=input()
k=int(input())
ans="1"
if len(s)!=s.count("1"):
    for c in s:
        if c!="1":
            ans=c
            break
print(ans)
s=input()
k=int(input())
for i in range(k):
  if s[i]!=1:
    print(s[i])
    exit()
print(1)
s = input()
k = int(input())

for i in range(k):
    if i > len(s):
        print(1)
        break
    if s[i] != "1":
        print(int(s[i]))
        break
s=input()
k=int(input())
if s[0]!="1":
    print(s[0])
else:
    if k==1:
        print(1)
    else:
        print(s[1])
S = input()
K = int(input())

for i, s in enumerate(S, 1):
    if s != "1":
        print(s)
        exit()

    if i == K:
        print(1)
S = input()
K = int(input())

for i in range(len(S)):
    if(S[i] == "1"):
        if(i == len(S)-1 and S[i] == "1"):
            print(1)
        else:    
            continue
    else:
        print(S[i])
        break
s = str(input())
k = int(input())

if k == 1:
    print(s[0])
    quit()
else:
    for i in s:
        if i != '1':
            print(i)
            quit()

print('1')
S = input()
K = int(input())
length = 0
t = 5 * 10 ** 15
for s in S:
    s = int(s)
    if s == 1: length += 1
    else:
        length += s * t
    if K < length:
        print(s)
        exit()
S = input()
K = int(input())
for i in range(len(S)):
  if(S[i] != '1'):
    print(int(S[i]))
    exit()
S = input()
K = int(input())
index = 0

for i in range(K):
    if (S[i] != '1'):
        index = i
        break

if (index == K - 1):
    print(1)
else:
    print(S[index])
s = input()
k = int(input())
ans = 1
for i in s:
    if i!= '1':
        ans = i
        break
print(ans)
s=list(input())
k=int(input())
for i in s:
    if i =="1":
        continue
    else:
        print(i)
        break
def myAnswer(S:list,K:int) -> int:
   if(K == 1): return S[0]
   ans = ""
   for s in S:
      if(s != "1"):
         ans = s
         break
   return ans

def modelAnswer():
   tmp=1
def main():
   S = list(input())
   K = int(input())
   print(myAnswer(S[:],K))

if __name__ == '__main__':
   main()
S = input()
K = int(input())

for i in range(K):
    if S[i] != "1":
        print(S[i])
        break
print("1")
s = input()
n = int(input())
for i in s:
    if n == 1:
        print(i)
        exit()
    else:
        if i == "1":
            continue
        else:
            print(i)
            exit()
s = input()
k = int(input())
front1 = 0
if s == "1":
  print(1)
for i in range(len(s)):
  if s[i] == "1":
    front1 += 1
  else:
    break
print(s[min(k-1, front1)])
def main():
  s, k = input(), input()
  t = set(s)
  if len(t) == 1 or s[0] != '1':
    ans = s[0]
  else:
    ans = s[1]
  
  print(ans)
  
if __name__ == '__main__':
  main()
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())

sys.setrecursionlimit(10 ** 9)


def main():
    S = INT()
    _ = INT()

    for i in str(S):
        if int(i) != 1:
            print(i)
            break
    else:
        print(1)


if __name__ == '__main__':
    main()
S=str(input())
K=int(input())

first_number=0
location=0
for i in range(len(S)):
  if int(S[i]) != 1:
    first_number = S[i]
    location = i
    break
if K <= location:
  print(1)
else:
  print(first_number)
import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce

s = input()
k = int(input())
for i in s:
    if i != "1":
        print(i)
        break
else:
    print(s[0])
S=input()
K=int(input())

for i in range(K):
  if S[i] != '1':
    print(S[i])
    break

if i == K:
  print(1)
S = input()
K = int(input())
length = 0
t = 5 * 10 ** 15
for c in range(t):
    for s in S:
        if int(s) == 1:
            length += 1
        else:
            length += t * int(s)
        if K <= length:
            print(s)
            exit()
import sys
import re
S = input()
array_S = list(S)

if not ( 4 <= len(S) <= 10 ):
    print('WA')
    sys.exit()
if len(re.findall('[A-Z]',S)) != 2:
    print('WA')
    sys.exit()

result = 0
if array_S[0] != 'A': result += 1
if array_S[2:-1].count('C') != 1: result += 1 
array_S.pop(0)
array_S.pop(array_S.index('C'))
if not "".join(array_S).islower(): result += 1 
print('WA') if result != 0 else print('AC')
S = list(input())
if S[0] != 'A':
    print('WA')
    exit()
S[0] = 'a'
if S.count('C') != 1:
    print('WA')
    exit()
i = S.index('C')
if i == 1 or i == len(S)-1:
    print('WA')
    exit()
S[S.index('C')] = 'c'
if ''.join(S) == ''.join(S).lower():
    print('AC')
else:
    print('WA')
S = list(input())

if S[0] == 'A':
    cnt = 0
    for i in range(2, len(S)-1):
        if S[i] == 'C':
            cnt += 1
    if cnt == 1:
        S.sort()
        for i in range(2, len(S)):
            if S[i].isupper():
                print('WA')
                exit()
        print('AC')
    else:
        print('WA')
else:
    print('WA')
s = input()
ans = True
if s[0]!='A':
    ans = False
if s[2:-1].count('C')!=1:
    ans = False
upper = 0
for i in  s:
    if i.isupper():
        upper += 1

if upper != 2:
    ans = False

if ans:
    print('AC')
else:
    print('WA')
import re
print("WA" if re.match('^A[a-z]+C[a-z]+$',input()) == None else "AC")
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')
s=input()
if (s[0]=="A") and (s[2:-1].count("C")==1) and ("C" not in s[:2]) and (s[-1] != "C"):
  s=s[1:]
  s=s.replace("C","")
  if s==s.lower():
    print("AC")
  else:
    print("WA")
else:
    print("WA")
s=input()
t=0
if s[0]=="A":
    if(s[2:-1].count("C")==1):
        for i in s:
            if i!="A" and i!="C":
                if i.isupper():
                    t=0
                    break
                else:
                    t=1
if t==0:
    print("WA")
else:
    print("AC")
S = input()
flag1 = False
if S[0] == "A":
    S=S.replace("A","",1)
    if "C" in S[1:-1]:
        S = S.replace("C", "", 1)
        if S.islower():
            print("AC")
        else:
            print("WA")
    else:
            print("WA")
else:
            print("WA")
S = list(input())
ans = "AC"

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

if S[2:-1].count("C") != 1:
  ans = "WA"
else:
  S.pop(S[2:-1].index("C") + 2)

if not "".join(S[1:]).islower():
  ans = "WA"

print(ans)
from re import match

if match("^A[a-z]+C[a-z]+$", input()):
    print('AC')
else:
    print('WA')
s = input()

ans = True if s[0] == 'A' else False
num = 0
for i in range(1, len(s)):
    if s[i] == 'C' and i != len(s) - 1 and i != 1:
        num += 1
    elif ord(s[i]) <= ord('Z') and ord(s[i]) >= ord('A'):
        ans = False
        break

if num != 1:
    ans = False

print('AC' if ans else 'WA')
s=input()
l=[]
L=[s[0]]
for i in range(2,len(s)-1):
    if s[i]=='C':
        L.append(s[i])
    else:
        l.append(s[i])
komoji=''.join(l)
komoji+=(s[1]+s[len(s)-1])

print('AC' if L==['A','C'] and str.islower(komoji) else 'WA')
s = input()
ok = True
if s[0] != 'A': ok = False
c = 0
# print(s)
for si in s[2:-1]:
    # print('si',si)
    if 'C' == si:
        c += 1
if c != 1: ok = False

for si in s[1:2]+s[-1]:
    # print('si2',si,si.lower())
    if si != si.lower(): ok = False

print('AC' if ok else 'WA')
f=True
s=input()
if s[0]!="A":f=False
if s.count("C")==0 or s.count("C")>=2:f=False
else:
    i=s.index("C")
    if i==1 or i==len(s)-1:f=False
    else:
        for x in range(len(s)):
            if x==i or x==0:continue
            if s[x].isupper():f=False
if f:print("AC")
else:print("WA")
s = list(input())
ans = "WA"

if s[0] == "A":
    if s[2:-1].count("C") == 1:
        s.remove("C")
        k = "".join(s[1:])
        if k.islower():
            ans = "AC"
print(ans)
s = input()
if s[0] == 'A' and s.count('A') == 1 and s.count('C') == 1 and s[2:-1].count('C') == 1:
    s = s.replace('A', '').replace('C', '')
    for c in s:
        if ord(c) < ord('a'):
            print('WA')
            exit(0)
    print('AC')
else:
    print('WA')
s = str(input())
if s[0] == 'A' and s[2:-1].count('C') == 1 and (s[1:s.find('C')]+s[s.find('C')+1:]).islower():
    print('AC')
else:
    print('WA')
# https://atcoder.jp/contests/abc104/tasks/abc104_b
s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1:
    t = s.replace('A', '')
    t = t.replace('C', '')
    for i in t:
        if ord('a') <= ord(i) <= ord('z'):
            continue
        else:
            print('WA')
            break
    else:
        print('AC')
else:
    print('WA')
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")
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")
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()
s = list(input())
flg = True

if s[0] != "A":
    flg = False

count = 0
for i in s[2:-1]:
    if i == "C":
        count += 1
if count != 1:
    flg = False

n = 0
for i in s:
    if i.isupper():
        n += 1
if n != 2:
    flg = False

if flg:
    print("AC")
else:
    print("WA")
S = input()

ans = 'AC'

if S[:1] != 'A':
    print('WA')
    exit()

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

X = S[1:].split('C')
for x in X:
    if x.islower():
        pass
    else:
        print('WA')
        exit()

print(ans)
s = input()
ans = 'WA'
if s[0] == 'A' and s[2:-1].count('C') == 1\
   and s.replace('A', '').replace('C', '').islower():
  ans = 'AC'
print(ans)
s = input()
ans = 1
if s[0] != 'A':
    ans = 0
if not 'C' in s[2:-1]:
    ans = 0
cnt = 0
for i in s:
    if i in [chr(i) for i in range(65, 65+26)]:
        cnt += 1
if cnt != 2:
    ans = 0
if ans == 1:
    print('AC')
else:
    print('WA')
S = input()

ans = "AC"

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

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

T = S[1:].replace("C","c",1)

if not T.islower() :
    ans = "WA"

print(ans)
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')
import re
print(re.match("A[a-z]+C[a-z]+$", input()) and "AC" or "WA")
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')
s = input()
if s[0]!='A' or s[2:-1].count('C')!= 1:
  print('WA')
  exit()
  
for c in s[1:]:
  if not(('a'<= c <= 'z') or  c=='C'):
    print('WA')
    break
else:
  print('AC')
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")
S = input()

ans = "WA"

if S[0]=="A" and S[2:-1].count("C")==1:
    if S[1:].replace("C","c").islower():
        ans = "AC"

print(ans)
s=str(input())
count=0
if s[0]=='A':
  count+=1
for i in range(2,len(s)-1):
  if s[i].count('C')==1:
    count+=1
s=s.replace('A','').replace('C','')
if s.islower()==True:
  count+=1
if count==3:
  print('AC')
else:
  print('WA')
S = input()

flag = 1
c_count = 0
if S[0] == 'A':
  for i in range(1,len(S)):
    if 2 <= i <= len(S)-2:
      if S[i] == 'C':
        c_count += 1
    else:
      if S[i].islower() == False:
        flag = 0
else:
  flag = 0
if c_count == 1 and flag == 1:
  print('AC')
else:
  print('WA')
s = list(input())

if s[0] == "A" and s[2:-1].count("C") == 1:
    s.remove("A")
    s.remove("C")
    
    if "".join(s).lower() == "".join(s):
        print("AC")
    else:
        print('WA')

else:
    print("WA")
S = input()
Cs = [i for i, c in enumerate(S) if c == "C" and 2 <= i <= len(S) - 2]
if S[0] == "A" and len(Cs) == 1 and (S[1 : Cs[0]] + S[Cs[0] + 1 :]).islower():
    print("AC")
else:
    print("WA")
s = list(input())

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

for i in range(len(s)):
    if s[i].islower()==True:
        continue
    else:
        print("WA")
        exit()

print("AC")
S = input()
if S[0] != 'A':
    print("WA")
elif ord(S[1]) < 97:
    print('WA')
elif ord(S[-1]) < 97:
    print("WA")
else:
    cnt = 0
    for i in range(1, len(S)-1):
        if S[i] == 'C':
            cnt += 1
    if cnt == 1:
        print("AC")
    else:
        print("WA")
# B - AcCepted

S = list(str(input()))
ans = 'AC'
if S[0] != 'A':
    ans = 'WA'
else:
    S[0] = 'a'

cnt = 0
for i in range(2, len(S)-1):
    if S[i] == 'C':
        cnt += 1
        S[i] = 'c'
if cnt != 1:
    ans = 'WA'

for s in S:
    if s.islower() == False:
        ans = 'WA'
        break

print(ans)
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")
S = input()

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

print("WA")
# -*- coding: utf-8 -*-
"""
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")
s=str(input())
if s[0] == "A" and s[2:-1].count("C") == 1:
    if s[1].islower() and s[-1].islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")
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")
s=input()
print('AC' if s[0]=='A' and 'C' in s and 1<s.index('C') and s.index('C')+1<len(s) and sum([c.isupper() for c in s])==2 else 'WA')
s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1:
    for i in range(1,len(s)):
        if s[i].islower() == True:
            continue
        else:
            if s[i] == 'C':
                continue
            else:
                print('WA')
                exit()
else:
    print('WA')
    exit()
print('AC')
s=input()
if s[0]=="A" and s[2:-1].count("C")==1:
    s=s.replace("A","")
    s=s.replace("C","")
    if (s.islower() == True):
        print("AC")
    else:
        print("WA")
else:
    print("WA")
s=list(input())
flag=1
if s[0]!='A':
    flag=0
if 'C' not in s[2:-1]:
    flag=0
if s.count('C')!=1:
    flag=0
if 'A' in s:
    s.remove('A')
if 'C' in s:
    s.remove('C')
s=''.join(s)
if s.islower():
    pass
else:
    flag=0
if flag==1:
    print('AC')
else:
    print('WA')
s = input()
n = len(s)
Ccnt = 0
def end():
  print('WA')
  exit(0)
  return 
for i in range(n):
  if i == 0:
    if s[i] != 'A':end()
  else:
    if s[i].isupper():
      if 2<=i<n-1 and s[i] == 'C':Ccnt += 1
      else:end()
if Ccnt != 1:end()
print('AC')
s = list(input())

ans = 'AC'
if s[0] != 'A':
    ans = 'WA'  

if s[2:-1].count('C') != 1:
    ans = 'WA'

cnt = 0
for i in s:
    
    if 'A' <= i <= 'Z':
        cnt += 1

if cnt != 2:
    ans = 'WA'

print(ans)
s = input()

if s[0] == 'A' and s[2:-1].count('C') == 1 and all([ord('a') <= ord(c) <= ord('z') for c in s.replace('A', '').replace('C', '')]):
  print('AC')
else:
  print('WA')
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)
s = input()
ans = "AC"
if s[0] == "A":
  c_cnt = 0
  for i in range(2,len(s)-1):
    if s[i] == "C":
      c_cnt += 1
  if c_cnt == 1:
    for i in s:
      if i.lower() != "a" and i.lower() != "c" and i.lower() != i:
        ans = "WA"
        break
  else:
    ans = "WA"
else:
  ans = "WA"
print(ans)
s=input()
print("AC" if "C" in s[2:-1] and "A" in s and s[1:].replace("C","",1).islower() else "WA")
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")
S = input()
ans = 'WA'
if S[0] == 'A' and S[2:-1].count('C') == 1:
    if S[1:].replace('C', '').islower():
        ans = 'AC'
print(ans)
s = list(input())
if s[0] == 'A':
    if 'C'in s[2:len(s) - 1]:
        s.remove('A')
        s.remove('C')
        s = ''.join(s)
        if s.islower() == True:
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')
s=input()
if s[0]=='A' and s[2:-1].count('C')==1 and s[1:].replace('C','').islower():
    print('AC')
else:
    print('WA')
import sys

S = input()

if S[0] == 'A' and S[2:-1].count('C') == 1:
    s = S.replace('A', 'a', 1).replace('C', 'c', 1)
    if s == S.lower():
        print('AC')
        sys.exit()

print('WA')
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")
S=input()
if S[0]=='A':
  if 'C' in S[2:-1]:
    S=S.lstrip('A')
    S=S.replace('C','',1)
    if str.islower(S):
      print('AC')
      exit()
print('WA')
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    if S[0] != 'A':
        print('WA')
        return

    if S[2 : len(S) - 1].count('C') != 1:
        print('WA')
        return

    if sum(1 for c in S if c.isupper()) != 2:
        print('WA')
        return

    print('AC')
    return


if __name__ == '__main__':
    main()
s = input()
ans = 'WA'

if s[0] == 'A':
    if s[2:-1].count('C') == 1:
        index = s[2:-1].find('C') + 2
        if s[1:index].islower() and s[index + 1:].islower():
            ans = 'AC'
print(ans)
s=input()
ans=0
if s[0]!='A':
    print("WA")
    exit()
for i in range(1,int(len(s))):
    if s[i].isupper():
        if i==1 or i==int(len(s))-1 or s[i]!='C':
            print("WA")
            exit()
        ans+=1
if ans !=1:
    print("WA")
    exit()
print("AC")
S = input()
if S[0] != 'A':
  print('WA')
elif S[2:-1].count('C') != 1:
  print('WA')
else:
  cindex = S.index('C')
  for i in range(len(S[1:])):
    if i+1 == cindex:
      continue
    if S[i+1].isupper():
      print('WA')
      exit()
  print('AC')
import bisect,collections,copy,heapq,itertools,math,operator,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
S = S()
condition1 = S[0]=='A'
condition2 = S[2:-1].count('C')==1
S = S.replace('A','a',1)
S = S.replace('C','c',1)
condition3 = S.islower()
print('AC' if condition1 and condition2 and condition3 else 'WA')
s = input()
letters = 'abcdefghijklmnopqrstuvwxyzAC'
print('AC' if s[0] == 'A' and s[2:-1].count('C') == 1 and all(c in letters for c in s) else 'WA')
import sys
S = input()

if S[0] != "A":
    print("WA")
    sys.exit()
if S[1].isupper() or S[-1].isupper():
    print("WA")
    sys.exit()
T = S[2:len(S)-1]
if list(T).count("C") == 0 or list(T).count("C") > 1:
    print("WA")
    sys.exit()
for i in range(len(T)):
    if T[i].isupper() and T[i] != "C":
        print("WA")
        sys.exit()
print("AC")
S = input()

cap = S[0]
mid = list(S[2:-1])

if (mid.count('C') >= 1):
    index = S.index('C')
    strr = S[1:index] + S[index + 1 :]
else:
    print('WA')
    exit()


if (cap == 'A' and mid.count('C') == 1 and strr.islower() == True):
    print('AC')
else:
    print('WA')