AtCoder Beginner Contest 104 - AcCepted

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-----
AtCoder

-----Sample Output-----
AC

The first letter is A, the third letter is C and the remaining letters are all lowercase, so all the conditions are satisfied.

Difficulty: EASY

Starter code:

Solutions:
import re
ptn = re.compile('A[a-z]+C[a-z]+')
print('AC' if re.fullmatch(ptn, input()) else 'WA')


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


a = input()
b = a[1:].replace('C', '')
print('WAAC'[a[0] == 'A' and 1 == a[2:-1].count('C') and (b.lower() == b)::2])


import re
print(re.match('A[a-z]+C[a-z]+$', input()) and 'AC' or 'WA')


s = input()
print('WAC'[s[0] == 'A' * (s.count('C', 2, -1) == 1) * s[1:].replace('C', '').islower():][:2])


import re
s = input()
if s[0] == 'A' and 'C' in s[2:-1] and (len(re.findall('[A-Z]', s)) == 2):
	print('AC')
else:
	print('WA')


s = input()
flag = False
if s[0] == 'A':
	if s[2:-1].count('C') == 1:
		if s[1:s.index('C')].islower() and s[s.index('C') + 1:].islower():
			flag = True
print('AC' if flag else 'WA')


s = input()
cnt_up = 0
cnt = 0
if s[0] == 'A':
	for i in range(len(s)):
		if s[i].isupper():
			cnt_up += 1
		if i > 1 and i < len(s) - 1 and (s[i] == 'C'):
			cnt += 1
if cnt_up == 2 and cnt == 1:
	print('AC')
else:
	print('WA')


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


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


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()
f = s[0] == 'A'
cnt = 0
for i in range(2, len(s) - 1):
	if s[i] == 'C':
		cnt += 1
f = f and cnt == 1
cnt = 0
for (c, d) in zip(s, s.lower()):
	if c != d:
		cnt += 1
f = f and cnt == 2
print('AC' if f else 'WA')


s = list(input())
al = list('abcdefghijklmnopqrstuvwxyz')
if s[0] == 'A' and s[-1] in al and (s[1] in al):
	del s[0]
	del s[0]
	del s[-1]
	f = 0
	for i in s:
		if i == 'C':
			if f == 1:
				print('WA')
				break
			else:
				f = 1
				continue
		elif i in al:
			continue
		else:
			print('WA')
			break
	else:
		if f == 1:
			print('AC')
		else:
			print('WA')
else:
	print('WA')


S = input()
AC = S[0] == 'A' and S[2:-1].count('C') == 1
for c in S[1:]:
	AC *= c >= 'a' and c <= 'z' or c == 'C'
print('AC' if AC else 'WA')


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


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


s = input()
print('WAAC'['A' == s[0] and s[2:-1].count('C') == 1 and s.replace('A', '').replace('C', '').islower()::2])


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


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


S = input()
print('WAAC'[('C' in S[2:-1]) * ('A' in S) * S[1:].replace('C', '', 1).islower()::2])


S = input()
if S[0] != 'A':
	print('WA')
	return
if 'C' not in S[2:-1]:
	print('WA')
	return
c_cnt = 0
for i in range(1, len(S)):
	if S[i] == 'C':
		c_cnt += 1
	elif S[i].isupper():
		print('WA')
		return
	if c_cnt >= 2:
		print('WA')
		return
print('AC')


s = input()
count = 0
for i in range(0, len(s)):
	if i == 0 and s[i] == 'A':
		continue
	if i == 1 and 97 <= ord(s[i]) <= 122:
		continue
	if 2 <= i <= len(s) - 2:
		if s[i] == 'C':
			count += 1
			continue
		elif 97 <= ord(s[i]) <= 122:
			continue
	if count == 0 or count >= 2:
		break
	if i == len(s) - 1 and 97 <= ord(s[i]) <= 122:
		print('AC')
		return
print('WA')


S = list(input())
if S[0] == 'A' and S[2:-1].count('C') == 1:
	S.pop(S[2:-1].index('C') + 2)
	S.pop(0)
	if ''.join(S) == ''.join(S).lower():
		print('AC')
	else:
		print('WA')
else:
	print('WA')


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


S = input()
if S[0] == 'A':
	if S[2:-1].count('C') == 1:
		S1 = S.replace('A', '')
		S2 = S1.replace('C', '')
		if all([x.islower() for x in S2]):
			print('AC')
			return
print('WA')


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


s = input()
s_1 = s[2:-1]
s_2 = s.replace('A', 'a')
s_3 = s_2.replace('C', 'c')
if s[0] == 'A' and s_1.count('C') == 1 and (s_3 == s.lower()):
	print('AC')
else:
	print('WA')


S = input()
check = False
if S[0] == 'A' and 'C' in S[2:-1]:
	i = list(S).index('C')
	T = S[1:i] + S[i + 1:]
	if T == T.lower():
		check = True
print('AC' if check else 'WA')


import re
s = input()
t = s[2:-1]
if s[0] == 'A' and len(re.findall('[a-z]', s)) == len(s) - 2 and ('C' in t):
	print('AC')
else:
	print('WA')


a = input()
a = list(a)
b = a[2:-1]
if a[0] == 'A':
	if b.count('C') == 1:
		a.remove('A')
		a.remove('C')
		a_str = ''.join(a)
		if a_str.islower():
			print('AC')
		else:
			print('WA')
	else:
		print('WA')
else:
	print('WA')


import re
s = input()
regex = re.compile('^A[a-z]+C[a-z]+$')
if regex.match(s):
	print('AC')
else:
	print('WA')


S = input()
flg = True
cnt = 0
for i in range(len(S)):
	if i == 0:
		if S[0] != 'A':
			flg = False
	elif i == 1:
		if S[1].isupper():
			flg = False
	elif i == len(S) - 1:
		if S[i].isupper():
			flg = False
	elif S[i] == 'C':
		cnt += 1
	elif S[i].isupper():
		flg = False
if cnt != 1:
	flg = False
print(['WA', 'AC'][flg])


s = 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 = list(s)
		s.remove('A')
		s.remove('C')
		a = ','.join(s)
		if a.islower() == True:
			print('AC')
		else:
			print('WA')
	else:
		print('WA')
else:
	print('WA')


import re
p = re.compile('^A[a-z][a-z]*C[a-z]+$')
s = input()
print('AC' if p.match(s) is not None else 'WA')


s = input()
print('AC' if s[0] == 'A' and s[2:-1].count('C') == 1 and (sum(map(str.isupper, s)) == 2) else 'WA')


s = input()
S = sorted(s)
print('AC' if s[0] == 'A' and s[2:-1].count('C') == 1 and ('Z' < S[2]) else 'WA')


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


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


s = input()
ok = True
ok = ok and s[0] == 'A'
cs = 0
for i in range(2, len(s) - 1):
	if s[i] == 'C':
		cs += 1
ok = ok and cs == 1
for i in range(1, len(s)):
	if s[i].islower():
		continue
	if s[i] == 'C':
		continue
	ok = False
print('AC' if ok else 'WA')


a = input()
b = a[2:len(a) - 1]
if a[0] == 'A' and b.count('C') == 1 and (len(a) - sum((1 for i in a if i.islower())) == 2):
	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')
				return
		print('AC')
	else:
		print('WA')
else:
	print('WA')


import re
print('AWCA'[re.match('^A[a-z]+C[a-z]+$', input()) == None::2])


def readinput():
	s = input()
	return s

def main(s):
	if s[0] != 'A':
		return 'WA'
	if s[2:-1].count('C') != 1:
		return 'WA'
	ls = s.lower()
	count = 0
	for (i, c) in enumerate(s):
		if c != ls[i]:
			count += 1
	if count != 2:
		return 'WA'
	else:
		return 'AC'

def __starting_point():
	s = readinput()
	ans = main(s)
	print(ans)
__starting_point()


import re
s = input()
pattern = '^A[a-z][a-z]*C{1}[a-z]*[a-z]$'
if re.match(pattern, s):
	print('AC')
else:
	print('WA')


S = input()
c = 0
if S[0] == 'A' and 'C' in S[2:len(S) - 1]:
	i = S.find('C')
	S = S[1:i] + S[i + 1:]
	if S.islower():
		c = 1
print('AC' if c == 1 else 'WA')


S = input()
ans = 0
C1 = 0
up = 0
if S[0] == 'A':
	ans += 1
for i in range(2, len(S) - 1):
	if S[i] == 'C':
		C1 += 1
for j in range(len(S)):
	if S[j].isupper() == 1:
		up += 1
if ans == 1 and C1 == 1 and (up == 2):
	print('AC')
else:
	print('WA')


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


s = list(input())
if s[0] == 'A' and s[2:-1].count('C') == 1 and ([e for e in s if e.isupper()] == ['A', 'C']):
	print('AC')
else:
	print('WA')


S = input()
if S[0] != 'A':
	print('WA')
	return
if 'C' not in S[2:-1]:
	print('WA')
	return
s = list(S)
s.remove('A')
s.remove('C')
for x in s:
	if x not in 'abcdefghijklmnopqrstuvwxyz':
		print('WA')
		return
print('AC')


s = input()
l = []
for i in s:
	l.append(i)
if l[0] != 'A':
	print('WA')
elif len(l) == 3:
	if l[1].islower() and l[2] == 'C':
		print('AC')
	else:
		print('WA')
else:
	l.remove('A')
	if 'C' not in l[1:len(l) - 1]:
		print('WA')
	else:
		l.remove('C')
		s = ''.join(l)
		if s.islower():
			print('AC')
		else:
			print('WA')


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


import re
s = input()
c = 'A[a-z]+C[a-z]+$'
print('AC' if re.match(c, s) else 'WA')


import re
S = input()
if S[0] == 'A' and S[2:-1].count('C') == 1 and (len(re.findall('[A-Z]', S)) == 2):
	print('AC')
else:
	print('WA')


s = input()
print(['WA', 'AC'][(s[0] == 'A') * (s.count('C', 2, -1) == 1) * s.replace('C', '')[1:].islower()])


s = input()
c_list = []
c_count = 0
answer = 'WA'
for i in range(2, len(s) - 1):
	if s[i] == 'C':
		c_list.append(i)
	if s[i].islower() == False:
		c_count += 1
if s[0] == 'A' and s[1].islower() == True and (s[-1].islower() == True) and (len(c_list) == 1) and (c_count == 1):
	answer = 'AC'
print(answer)


s = input()
if s[0] == 'A' and 'C' in s[2:-1] and (sum([i.isupper() for i in s]) == 2):
	print('AC')
	exit()
print('WA')


s = list(input())
ans = 'AC'
if s[0] != 'A':
	ans = 'WA'
c_idx = None
for (i, v) in enumerate(list(s)):
	if i >= 2 and i <= len(s) - 2:
		if v == 'C':
			if c_idx is None:
				c_idx = i
			else:
				ans = 'WA'
if c_idx is None:
	ans = 'WA'
else:
	s[0] = 'a'
	s[c_idx] = 'c'
	if [i.lower() for i in s] != s:
		ans = 'WA'
print(ans)


import re
s = input()
if re.match('A[a-z]+C[a-z]+\\Z', s) == None:
	print('WA')
else:
	print('AC')


import re
print('AC' if re.match('\\AA[a-z]+C[a-z]+\\Z', input()) else 'WA')


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()
if s[0] == 'A' and s[2:-1].count('C') == 1 and (sum((_ == _.upper() for _ in s)) == 2):
	print('AC')
else:
	print('WA')


a = input()
b = a[1:].replace('C', '')
c = b.lower()
print(['WA', 'AC'][a[0] == 'A' and a[2:-1].count('C') == 1 and (b == c)])


S = input()
b = False
if S[0] == 'A' and S[2:-1].count('C') == 1:
	c = 0
	for s in S:
		if s.isupper():
			c += 1
	if c == 2:
		b = True
print('AC' if b else 'WA')


import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7

def resolve():
	S = input().rstrip()
	n = len(S)
	if S[0] == 'A':
		cnt = 0
		for i in range(2, n - 1):
			if S[i] == 'C':
				cnt += 1
		if cnt == 1:
			for i in range(n):
				if S[i] == 'A' or S[i] == 'C':
					continue
				elif S[i].isupper():
					print('WA')
					break
			else:
				print('AC')
		else:
			print('WA')
	else:
		print('WA')

def __starting_point():
	resolve()
__starting_point()


S = input()
count = 0
list1 = ''
list2 = ''
if S[0] == 'A':
	count += 1
if S[2:-1].count('C') == 1:
	count += 1
for n in S:
	if n == 'A' or n == 'C':
		list1 += n
	else:
		list2 += n
if list2.islower():
	count += 1
if count == 3:
	print('AC')
else:
	print('WA')


s = input()
cnt = 0

def end():
	print('WA')
	return
if len(s) < 3:
	end()
if s[0] == 'A' and s.count('C') == 1:
	if 'C' in s[2:-1]:
		for i in s:
			if i == i.upper():
				cnt += 1
		if cnt == 2:
			print('AC')
			return
end()


def main():
	s = input()
	len_s = len(s)
	if s[0] == 'A' and s[2:-1].count('C') == 1 and (sum((s[i].islower() for i in range(len_s))) == len_s - 2):
		print('AC')
	else:
		print('WA')
main()


import re
s = input()
s1 = re.fullmatch('A([a-z]+)C([a-z]+)', s)
if s1 == None:
	print('WA')
else:
	print('AC')


S = list(input())
stl = len(S) - 2
countOfC = 0
if S[0] != 'A':
	print('WA')
	return
for i in range(1, len(S)):
	if S[i].isupper():
		if i >= 2 and i <= stl and (S[i] == 'C'):
			countOfC += 1
		else:
			print('WA')
			return
if countOfC == 1:
	print('AC')
else:
	print('WA')


S = str(input())
if S == 'AccccCcccc':
	print('AC')
elif S[0] == 'A':
	S1 = 'a' + S[1:]
	if S[2] == 'C':
		S2 = S1[:2] + 'c' + S1[3:]
		if S2.islower():
			print('AC')
		else:
			print('WA')
	elif S[-2] == 'C':
		S2 = S1[:-2] + 'c' + S1[-1]
		if S2.islower():
			print('AC')
		else:
			print('WA')
	else:
		print('WA')
else:
	print('WA')


import re

def answer(s: str) -> str:
	pattern = '^A[a-z]+C[a-z]+$'
	return 'AC' if re.match(pattern, s) else 'WA'

def main():
	s = input()
	print(answer(s))

def __starting_point():
	main()
__starting_point()


S = input()
print(['AC', 'WA'][not ('A' == S[0] and 1 == S[2:-1].count('C') and (S[1] + S[2:-1].replace('C', '') + S[-1]).islower())])


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


S = input()
if S[0] == 'A':
	if 'C' in S[2:-1]:
		if S[1:].replace('C', '', 1).islower():
			print('AC')
			exit()
print('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()
ans = 'AC'
if S[0] != 'A':
	ans = 'WA'
if S[2:-1].count('C') != 1:
	ans = 'WA'
else:
	index = 2 + S[2:-1].index('C')
	if not (S[1:index] + S[index + 1:]).islower():
		ans = 'WA'
print(ans)


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


S = input()
print('WAAC'[S[0] == 'A' and S[2:-1].count('C') == 1 and (len(list(filter(str.isupper, S))) == 2)::2])


S = input()
if S.startswith('A'):
	if S[1].islower() and S[-1].islower():
		count_lower = 0
		count_C = 0
		for s in S[2:-1]:
			if s == 'C':
				count_C += 1
			if s.islower():
				count_lower += 1
		if count_C == 1 and count_lower == len(S) - 4:
			print('AC')
		else:
			print('WA')
	else:
		print('WA')
else:
	print('WA')


S = input()
if S[0] == 'A' and S[2:-1].count('C') == 1:
	SC = S.index('C')
	if (S[1:SC] + S[SC + 1:]).islower():
		print('AC')
	else:
		print('WA')
else:
	print('WA')


s = input()
if len(s) < 4:
	print('WA')
elif s[0] != 'A':
	print('WA')
elif s[2:-1].count('C') != 1:
	print('WA')
else:
	tmp = s[1] + s[2:].replace('C', 'c')
	if tmp != tmp.lower():
		print('WA')
	else:
		print('AC')


import sys
S = input()
if not (S[0] == 'A' and 'C' in S[2:len(S) - 1]):
	print('WA')
	return
S = sorted(S)
if not S[1] == 'C':
	print('WA')
	return
if not 'a' <= S[2] <= 'z':
	print('WA')
	return
print('AC')


import re

def solve(s):
	return 'AC' if re.match('^A[a-z]+C[a-z]+$', s) else 'WA'
_s = input()
print(solve(_s))


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


import re
s = input()
print(s[0] == 'A' and s[2:-1].count('C') == 1 and (len(re.findall('[a-z]', s)) == len(s) - 2) and 'AC' or 'WA')


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


import re
S = input()
if S[0].isupper() and S[2:-1].count('C') == 1 and re.sub('[AC]', '', S).islower():
	print('AC')
else:
	print('WA')


import sys

def resolve(in_):
	S = next(in_).strip()
	if S[0] != 'A':
		return False
	if S.count('C', 2, -1) != 1:
		return False
	i = S.find('C')
	a = S[1:i]
	b = S[i + 1:]
	if not (a.islower() and b.islower()):
		return False
	return True

def main():
	answer = resolve(sys.stdin)
	print('AC' if answer else 'WA')

def __starting_point():
	main()
__starting_point()


S = input()
if S[0] == 'A' and S[2:-1].count('C') == 1 and (sum([c.isupper() for c in S]) == 2):
	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', 'c').islower():
		ans = 'AC'
print(ans)


s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1 and (sum((x.isupper() for x in s)) == 2):
	print('AC')
else:
	print('WA')


import sys
S = input().strip()
if S[0] != 'A':
	print('WA')
	return
count = 0
for char in S[2:-1]:
	if char == 'C':
		count += 1
if count != 1:
	print('WA')
	return
for char in S[1:]:
	if char.isupper() and char != 'C':
		print('WA')
		return
print('AC')


s = list(input())
flg = 'WA'
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:
			flg = 'AC'
print(flg)


import re
in_data = input()
if None != re.fullmatch('A[a-z]+C[a-z]+', in_data):
	print('AC')
else:
	print('WA')


s = input()
if s[0] == 'A':
	sub = s[2:-1]
	if sub.count('C') == 1:
		if all((c.islower() for c in s[1:].replace('C', ''))):
			print('AC')
			return
print('WA')


import re
print('WA' if re.match('A[a-z]+C[a-z]+$', input()) is None else 'AC')


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


import sys
import math
sys.setrecursionlimit(10 ** 8)
ini = lambda : int(sys.stdin.readline())
inm = lambda : map(int, sys.stdin.readline().split())
inl = lambda : list(inm())
ins = lambda : sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print('\x1b[33m', *a, '\x1b[0m', **dict(file=sys.stderr, **kw))
ans = 'AC'
S = list(input())
if S.pop(0) != 'A':
	ans = 'WA'
if S.pop(0).isupper():
	ans = 'WA'
mid = S[0:-1]
if mid.count('C') == 1:
	mid.remove('C')
	for c in mid:
		if c.isupper():
			print(c)
			ans = 'WA'
else:
	ans = 'WA'
if S[-1].isupper():
	ans = 'WA'
print(ans)


S = input()
if S[0] == 'A':
	c = list(S[2:-1])
	if c.count('C') == 1:
		p = c.index('C')
		c.pop(p)
		ans = list(S[1]) + c + list(S[-1])
		anss = ''.join(ans)
		if anss.islower():
			print('AC')
		else:
			print('WA')
	else:
		print('WA')
else:
	print('WA')


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


S = input()
if S[0] == 'A' and S[2:-1].count('C') == 1 and (sum([int(c.islower()) for c in S]) == len(S) - 2):
	print('AC')
else:
	print('WA')


s = list(map(str, input()))
if s[0] != 'A':
	print('WA')
elif s[2:-1].count('C') != 1:
	print('WA')
else:
	del s[0]
	s.remove('C')
	if ''.join(s).islower():
		print('AC')
	else:
		print('WA')


A = input()
B = A.lower()
C = 0
for i in range(len(A)):
	if A[i] != B[i]:
		C += 1
if A[0] != 'A' or C != 2:
	print('WA')
elif 'C' in A[2:-1]:
	print('AC')
else:
	print('WA')


import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = 'AtCoder'
		output = 'AC'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = 'ACoder'
		output = 'WA'
		self.assertIO(input, output)

	def test_入力例_3(self):
		input = 'AcycliC'
		output = 'WA'
		self.assertIO(input, output)

	def test_入力例_4(self):
		input = 'AtCoCo'
		output = 'WA'
		self.assertIO(input, output)

	def test_入力例_5(self):
		input = 'Atcoder'
		output = 'WA'
		self.assertIO(input, output)

def resolve():
	S = input()
	l = len(S)
	ans = 'AC'
	cf = False
	for i in range(l):
		if i == 0:
			if S[i] != 'A':
				ans = 'WA'
				break
		elif i == 1 or i == l - 1:
			if S[i] == 'C' or S[i].isupper():
				ans = 'WA'
				break
		elif S[i] == 'C':
			if cf == True:
				ans = 'WA'
				break
			else:
				cf = True
		elif S[i].isupper():
			ans = 'WA'
			break
	else:
		if cf == False:
			ans = 'WA'
	print(ans)

def __starting_point():
	resolve()
__starting_point()


import sys
S = input()
count = 0
for i in range(len(S)):
	if i == 0 and S[i] != 'A':
		print('WA')
		return
	if i == len(S) - 1 and count != 1:
		print('WA')
		return
	if i != 0 and i != len(S) - 2 and S[i].isupper() and (S[i] != 'C'):
		print('WA')
		return
	if i >= 2 and i <= len(S) - 2 and (S[i] == 'C'):
		count += 1
print('AC')


s = input()
if s[0] == 'A' and 'C' in s[2:-1] and all((elem == elem.lower() for (i, elem) in enumerate(s) if i != 0 and i != s.index('C'))):
	print('AC')
else:
	print('WA')


import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

def I():
	return int(input())

def F():
	return float(input())

def SS():
	return input()

def LI():
	return [int(x) for x in input().split()]

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return [float(x) for x in input().split()]

def LSS():
	return input().split()

def resolve():
	S = SS()
	if S[0] == 'A' and 'C' in S[2:-1] and (len([i for i in S if i in string.ascii_uppercase]) == 2):
		print('AC')
	else:
		print('WA')

def __starting_point():
	resolve()
__starting_point()


word = input()
flag = False
C_count = 0
if word[0] == 'A':
	for i in range(2, len(word) - 1):
		if word[i] == 'C' and C_count == 0:
			C_count += 1
			C_place = i
		elif word[i] == 'C' and C_count == 1:
			C_count += 1
	if C_count == 1:
		for i in range(1, len(word)):
			if word[i].isupper() and i != C_place:
				break
			if i == len(word) - 1:
				flag = True
if flag:
	print('AC')
else:
	print('WA')


s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1:
	for i in range(1, len(s)):
		if s[i] != 'C':
			if not s[i] in 'abcdefghijklmnopqrstuvwxyz':
				print('WA')
				return
	print('AC')
	return
print('WA')


import re
S = input()
result = re.match('^A[a-z]{1}[a-z]{0,6}C[a-z]{1,7}$', S)
if result:
	print('AC')
else:
	print('WA')


a = input()
b = sorted(a)
print('AC' if a[0] == 'A' and 'C' in a[2:-1] and (b[2] > 'Z') else 'WA')


S = input()
ans = 0
if S[0] == 'A':
	ans += 1
cnt = 0
for i in range(2, len(S) - 1):
	if S[i] == 'C':
		cnt += 1
if cnt == 1:
	ans += 1
cnt = 0
for i in range(len(S)):
	if S[i].isupper():
		cnt += 1
if cnt == 2:
	ans += 1
if ans == 3:
	print('AC')
else:
	print('WA')


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


A = input()
if A[0] != 'A':
	print('WA')
	return
if A[2:-1].count('C') != 1:
	print('WA')
	return
for i in range(1, len(A)):
	if A[i] != 'C' and (not A[i].islower()):
		print('WA')
		break
else:
	print('AC')


s = input()
answer = 'WA'
if s[0] == 'A':
	if s.count('C', 2, len(s) - 1) == 1:
		a = s.index('C')
		t = s[1:a] + s[a + 1:]
		if t.islower():
			answer = 'AC'
print(answer)


S = str(input())
N = len(S)
flag = True
cnt = 0
if S[0] != 'A' or S[2:N - 1].count('C') != 1:
	flag = False
else:
	for i in range(N):
		if S[i].islower():
			cnt += 1
	if cnt != N - 2:
		flag = False
if flag:
	print('AC')
else:
	print('WA')


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


s = input()
if s[0] != 'A':
	print('WA')
	return
if 'C' not in s[2:len(s) - 1]:
	print('WA')
	return
cnt = 0
for i in s:
	if i.isupper():
		cnt += 1
if cnt != 2:
	print('WA')
	return
print('AC')


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


S = input()
print('WAAC'[all(['C' in S[2:-1], S[0] == 'A', S[1:].replace('C', '', 1).islower()])::2])


S = input()
N = len(S)
ans = 'AC'
if S[0] != 'A':
	ans = 'WA'
c = 0
for i in range(1, N):
	if 2 <= i <= N - 2 and S[i] == 'C':
		c += 1
	elif S[i] < 'a' or 'z' < S[i]:
		ans = 'WA'
if c != 1:
	ans = 'WA'
print(ans)


S = input()
k = 0
z = 0
cnt = 0
if S[0] == 'A':
	for i in range(2, len(S) - 1):
		if S[i] == 'C':
			k = i
			cnt += 1
			z = 100
			if z == 100 and cnt == 1:
				for j in range(1, k):
					if 'a' <= S[j] <= 'z':
						z = 200
					else:
						print('WA')
						return
				if z == 200:
					for l in range(k + 1, len(S)):
						if 'a' <= S[l] <= 'z':
							z = 102
						else:
							print('WA')
							return
if z == 0 or z == 100:
	print('WA')
else:
	print('AC')


s = input()
n = len(s)
t = s.lower()
if s[0] == 'A' and s.count('C') == 1 and (s[1] != 'C') and (s[n - 1] != 'C'):
	cnt = 0
	for i in range(n):
		if s[i] != t[i]:
			cnt += 1
	if cnt == 2:
		print('AC')
		return
print('WA')


S = str(input())
ans = 'WA'
if S[0] == 'A':
	if 'C' in S[2:-1] and S.count('C') == 1:
		x = S.index('C')
		S = S[0].lower() + S[1:x] + S[x].lower() + S[x + 1:]
		if S == S.lower():
			ans = 'AC'
print(ans)


s = input()
s2 = s.replace('A', '').replace('C', '')
print('WAAC'[s2 == s2.lower() and s[0] == 'A' and (s[2:-1].count('C') == 1)::2])


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


S = input()
T = S.replace('A', '')
T = T.replace('C', '')
U = T.lower()
if S[0] == 'A' and S.count('A') == 1 and (S[2:-1].count('C') == 1) and (S.count('C') == 1) and (T == U):
	print('AC')
else:
	print('WA')


import sys
input = sys.stdin.readline

def main():
	s = input()
	if s[0] != 'A':
		print('WA')
		return
	if s[2:-2].count('C') != 1:
		print('WA')
		return
	s = s.replace('A', '')
	s = s.replace('C', '')
	if s.islower() == False:
		print('WA')
		return
	else:
		print('AC')

def __starting_point():
	main()
__starting_point()


s = input()
flag = True
if s[0] != 'A':
	flag = False
res = 0
for i in range(2, len(s) - 1):
	if s[i] == 'C':
		res += 1
	if res >= 2:
		flag = False
		break
if res == 0:
	flag = False
res = 0
for i in range(0, len(s)):
	if s[i].isupper():
		res += 1
	if res > 2:
		flag = False
		break
if flag:
	print('AC')
else:
	print('WA')


S = input()
s = S[2:-1]
T = S[1:].replace('C', '', 1)
if S[0] == 'A' and 'C' in s and (T.islower() == True):
	print('AC')
else:
	print('WA')


def isAC(S):
	if S[0] != 'A':
		return False
	if S[2:-1].count('C') != 1:
		return False
	S = S[1:].replace('C', '')
	if not all(('a' <= x <= 'z' for x in S)):
		return False
	return True
print('AC' if isAC(input()) else 'WA')


s = input()
n = len(s)
if s[0] == 'A' and s[2:n - 1].count('C') == 1 and (len(set(s.upper()) & set(s)) == 2):
	print('AC')
else:
	print('WA')


S = input()
C_cnt = 0
if S[0] == 'A' and S[1].islower() and S[-1].islower():
	temp = S[2:len(S)]
	if temp.count('C') == 1:
		for t in temp:
			if t != 'C' and t.isupper() == True:
				print('WA')
				return
		else:
			print('AC')
			return
print('WA')


s = input()
ans = True
cnt = 0
for (i, char) in enumerate(s):
	if i == 0:
		if char != 'A':
			ans = False
			break
	elif 2 <= i and i <= len(s) - 2:
		if char == 'C':
			cnt += 1
	elif char.isupper():
		ans = False
		break
if cnt == 1 and ans:
	print('AC')
else:
	print('WA')


S = input()
r = 'WA'
n = len(S)
l = list(S)
if S[0] == 'A' and S[2:n - 1].count('C') == 1:
	s = S.replace('A', 'p').replace('C', 'p')
	if s.islower():
		r = 'AC'
print(r)


S = input()
N = len(S)
if S[0] == 'A' and S[2:N - 1].count('C') == 1 and (sum((s.islower() for s in S)) == N - 2):
	print('AC')
else:
	print('WA')


s = input()
if s[0] != 'A':
	ans = 'WA'
else:
	c_cnt = s.count('C', 2, len(s) - 1)
	cnt = s.count('C')
	if c_cnt != 1 or c_cnt != cnt:
		ans = 'WA'
	else:
		s = s.replace('C', 'c')
		if s[1:].islower():
			ans = 'AC'
		else:
			ans = 'WA'
print(ans)


import string
s = string.ascii_lowercase
s += 'C'
S = input()
buttanA = False
buttanB = False
buttanC = True
for i in range(len(S)):
	if S[0] == 'A':
		buttanA = True
	if S[i] == 'C' and 2 <= i < len(S) - 1:
		if buttanB == False:
			buttanB = True
		else:
			print('WA')
			return
	if S[i] not in s and 1 <= i < len(S):
		buttanC = False
if buttanA == buttanB == buttanC == True:
	print('AC')
else:
	print('WA')


S = input()
if S[0] == 'A' and 'C' in S[2:-1]:
	idx = S.index('C')
	if all((c.islower() or i in (0, idx) for (i, c) in enumerate(S))):
		print('AC')
	else:
		print('WA')
else:
	print('WA')


import re
pattern = 'A[a-z]+C[a-z]+'
if re.fullmatch(pattern, input()):
	print('AC')
else:
	print('WA')


import re
p = re.compile('^A[a-z]{1,}C[a-z]{1,}$')
S = input()
if bool(p.match(S)):
	print('AC')
else:
	print('WA')


import sys
input = sys.stdin.readline

def main():
	S = list(input().strip())
	if S[0] == 'A' and S[2:-1].count('C') == 1:
		cnt = 0
		for s in S:
			if s.islower():
				cnt += 1
		if cnt == len(S) - 2:
			print('AC')
		else:
			print('WA')
	else:
		print('WA')

def __starting_point():
	main()
__starting_point()


S = input()
if S[0] == 'A' and S.count('C') == 1 and ('C' in S[2:-1]):
	for c in S[1:len(S)]:
		if not (c.islower() or c == 'C'):
			print('WA')
			break
	else:
		print('AC')
else:
	print('WA')


s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1 and s[-1].islower():
	ind = s.index('C')
	if s[1:ind].islower() and (ind == len(s) - 2 or s[ind + 1:-1].islower()):
		print('AC')
		return
print('WA')


S = input()
if S[0] == 'A' and S[1].islower() and ('C' in S[2:-1]):
	SS = S.replace('C', '').replace('A', '')
	if SS.islower() and len(SS) == len(S) - 2:
		print('AC')
	else:
		print('WA')
else:
	print('WA')


S = input()
print('WAAC'[S[0] == 'A' and S.count('C', 2, -1) == 1 and (len(list(filter(lambda x: x.isupper(), list(S)))) == 2)::2])


import re
s = input()
print('AC' if s[0] == 'A' and s[2:-1].count('C') == 1 and (re.sub('A|C', '', s) == re.sub('A|C', '', s).lower()) else 'WA')