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:
import re

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

Submission status: Accepted

Solution code:
S=input()
ch="abcdefghijklmnopqrstuvwxyz"
ans=True

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

if cnt!=1:
  ans=False
  
cnt=0
for i in range(1,len(S)):
  if not(S[i] in ch):
    cnt+=1
if cnt!=1:
  ans=False
  
if ans:
  print("AC")
else:
  print("WA")

Submission status: Accepted

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

cnt = 0
for i in range(2,len(s)-1):
    if s[i] == 'C':
        cnt +=1
    elif s[i].isupper():
        res = False
        
if cnt != 1:
    res = False

if s[1].isupper() or s[-1].isupper():
    res = False

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

Submission status: Accepted

Solution code:
from sys import stdin

S = stdin.readline().rstrip()

ans = "AC"

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

C_count = 0
for i in range(2,len(S)-1):
    if S[i] == 'C':
        C_count += 1

if C_count != 1:
    ans = "WA"

U_count = 0
for i in range(len(S)):
    if S[i].isupper():
        U_count += 1

if U_count != 2:
    ans = "WA"

print(ans)

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
S = input()
res = 'AC'
count = 0
if S[0] != 'A':
    res = 'WA'
       
for i in range(2, len(S)):
    if S[i] == 'C':
        count += 1
    elif S[i].isupper():
        res = 'WA'
        break

if S[-1].isupper():
    res = 'WA'
    
if S[1].isupper():
    res = 'WA'
    
if count != 1:
    res = 'WA'
        
print(res)

Submission status: Accepted

Solution code:
inp = list(input())
flag = True
if inp.pop(0) != "A":
    flag = False
if inp[1:-1].count("C") != 1:
    flag = False
else:
    inp.remove("C")
if not "".join(inp).islower():
    flag = False
if flag:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()

if s[0] == "A":
    s = s.replace("A", "a", 1)
    index = s.find("C")
    if index == s.rfind("C") and index >= 2 and index <= len(s) - 2:
        s = s.replace("C", "c", 1)
        if (s.islower()):
            print("AC")
            exit()
print("WA")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Aug  5 19:16:30 2018
ABC104B
@author: maezawa
"""

s = input()

flag = 0
if s[0] == 'A':
    if s.count('C', 2, -1) == 1:
        s1 = s[1:]
        s2 = s1.replace('C', 'c')
        if s2.islower():
            print('AC')
            flag = 1

if flag == 0:
    print('WA')

Submission status: Accepted

Solution code:
import string
S  = input()
lower = string.ascii_lowercase
n = len(S)
interest_part = S[2:-1] 
interest_index_list = []

if S[0] != 'A':
    print('WA')
else:
    C_counter = 0
    for i in range(len(interest_part)):
        if interest_part[i] == 'C':
            C_counter += 1
            interest_index_list.append(i+2)
    if C_counter != 1:
        print('WA')
    else:
        sub_string = S[:interest_index_list[0]] + S[interest_index_list[0]+1:]
        sub_string = sub_string[1:]
        for i in sub_string:
            if i not in lower:
                print('WA')
                break
        else:
            print('AC')

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
# input
S = input()

temp = 0
C = 0
ans = 0

if S[0] == 'A':
    ans += 1

for i in range(2, len(S) - 1):
    if S[i] == 'C':
        temp += 1
        C = i
if temp == 1:
    ans += 1

if S[1].islower():
    for i in range(2, len(S)):
        if i != C and S[i].isupper():
            print('WA')
            exit()
    ans += 1

if ans == 3:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
import sys
import re

oomoji = re.compile(r"[A-Z]")
S = list(raw_input())
if S[0] != 'A':
  print 'WA'
  sys.exit(0)
C = 0
for i in range(2,len(S)-1):
  if S[i] == 'C':
    C += 1
  elif oomoji.match(S[i]):
    print 'WA'
    sys.exit(0)
if C != 1 or oomoji.match(S[len(S)-1]) or oomoji.match(S[1]):
  print 'WA'
else :
  print 'AC'

Submission status: Accepted

Solution code:
s = list(input())

flag = True

if s[0] != 'A':
    flag = False

l = s[2:len(s)-1]

count = 0
c = 0
for i,x in enumerate(l):
    if x == 'C':
        count += 1
        c = i

if count != 1:
    flag = False

s.pop(2+c)
s.pop(0)

for x in s:
    if x not in list('abcdefghijklmnopqrstuvwxyz'):
        flag = False

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

Submission status: Accepted

Solution code:
S = input()

cond = True

if not S[0] == 'A':
    cond = False

if not S[2:-1].count('C') == 1:
    cond = False

for i, s in enumerate(S):
    if i == 0:
        continue

    if s.isupper():
        if s == 'C':
            if i < 2 or len(S)-2 < i:
                cond = False
        else:
            cond = False

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S=raw_input()
l=len(S)

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

s=2
e=l-2
cnt=0
for i in range(s,e+1):
	if S[i]=="C": cnt+=1

if cnt!=1:
	print "WA"
	quit()

komoji=list("abcdefghijklmnopqrstuvwxyz")

for i in range(1,l):
	if S[i]=="C": continue
	if S[i] not in komoji:
		print "WA"
		quit()


print "AC"

Submission status: Accepted

Solution code:
S = input()

Aflag = False
Cflag = False
smallflag=False
length = len(S)

for i,a in enumerate(S):
    if i==0 and a=='A':
        Aflag = True
    elif 2<=i<=length-2 and a=='C' and Cflag == False:
        Cflag = True
    elif not a.islower():
        smallflag = True

if Aflag and Cflag and (not smallflag):
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
s = input()
flag = False
if s[0] == "A":
    for i, c in enumerate(s[1:]):
        if 1 <= i <= len(s)-3:
            if c == "C":
                if flag:
                    print("WA")
                    exit()
                flag = True
                continue
        if not 0 <= ord(c)-97 <= 26:
            print("WA")
            exit()
if flag:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
S=input()
import sys

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

count=0
for i in range (len(S[2:len(S)-1])):
    if S[2:len(S)-1][i]=='C':
        count+=1
if count!=1:
    print ('WA')
    sys.exit()
    
count2=0
for j in range (len(S)):
    if S[j].isupper()==True:
        count2+=1
if count2!=2:
    print ('WA')
    sys.exit()

print('AC')

Submission status: Accepted

Solution code:
n=input()
clear=0
if n[:1]=='A' and n.find('C',n.find('C')+1)==-1 and n.find('C') >1 and n.find('C') <len(n)-1:
    n=n.replace('A','')
    n=n.replace('C','')
    if n.islower()==True:
        clear=1
if clear==1:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
import re
S = input()
flag = False
if len(re.findall('[A-Z]',S)) == 2:
    if S[0] == "A":
        if S[-1] != "C":
            if S[2:-1].count("C") == 1:
                flag = True

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

Submission status: Accepted

Solution code:
import sys

char = list(input())
if char[0] != 'A':
  print('WA')
  sys.exit()

count = 0
idx_C = 0
for i, x in enumerate(char[2:len(char) - 1]):
  if x == 'C':
    count += 1
    idx_C = i + 2

if count != 1:
  print('WA')
  sys.exit()

for i, x in enumerate(char):
  if i != 0 and i != idx_C and x.isupper():
    print('WA')
    sys.exit()
  
print('AC')

Submission status: Accepted

Solution code:
def judge(S:str) -> bool:
    if S[0] != "A":
        return False
    
    elif S[2:-1].count("C") != 1:
        return False
    
    else:
        s_list = list(S)
        s_list.remove("A")
        s_list.remove("C")
        for s in s_list:
            if ord(s)<ord("a") or ord(s)>ord("z"):
                return False

        return True
            
S = input()

if judge(S):
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()

if s[0] != 'A' or s[1]<'a':
  print('WA')
else:
  tmp=0
  for i in range(2,len(s)-1):
    if s[i]<'a':
      tmp+=1
      if s[i] != 'C' or tmp==2:
        print('WA')
        exit()
  if tmp!=1:
    print('WA')
    exit()
  if s[-1] <'a':
    print('WA')
    exit()
  print('AC')

Submission status: Accepted

Solution code:
S=input()
flag=0
if S[0]=="A":
    pass
else:
    flag=1
#print(S)
S=S[1:]
#print(S)
if S[1:-1].count("C")==1:
    pass
else:
    flag=1
#print(S[1:-1])
#print(A)
list1=[]
for i in range(len(S)):
    if S[i]=="C":
        pass
    else:
        list1.append(S[i])
if len(S)==len(list1)+1:
    if "".join(list1).islower()==True:
        pass
    else:
        flag=1
else:
    flag=1
    
if flag==0:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = input()
flag = False
if S[0] == "A" and S[2:len(S)-1].count("C") == 1:
    for i in range(1,len(S)):
        if S.index("C") == i:
            continue
        if S[i].islower() == False:
            flag = False
            break
        else:
            flag = True
if flag:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
# temp
A = str(input())

ACcheck=0;

if(A[0]=="A"):
    A=A.replace("A", "a");
    if(A.count('C')==1):
        if(A[1]!="C" and A[-1]!="C"):
            A=A.replace("C", "c");
            if(A.lower()==A):
                ACcheck=1;

if(ACcheck==0):
    print("WA");
else:
    print("AC");

Submission status: Accepted

Solution code:
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

s = input()

cs = 0
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':
            cs += 1
            if cs > 1:
                print('WA')
                exit()
        else:
            if not s[i].islower():
                print('WA')
                exit()
    else:
        if not s[i].islower():
            print('WA')
            exit()

if cs == 0:
    print('WA')
else:
    print('AC')

Submission status: Accepted

Solution code:
S = input()

flag = 0

for index, i in enumerate(S):
	if not index:
		if not i == "A":
			print("WA")
			break
		continue

	if 1 < index and index < len(S) - 1:
		if i == "C":
			if not flag:
				flag = 1
				continue
			else:
				print("WA")
				break
	if not i.islower():
		print("WA")
		break

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

Submission status: Accepted

Solution code:
S = input()

l = list(S)

c = 0

b = 0

for i in range(2, len(l) - 1):
    if l[i] == 'C':
        c += 1
        
for i in range(len(l)):
    if l[i].isupper() == True:
        b += 1

if l[0] == 'A' and c == 1 and b == 2:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
from sys import stdin
from string import ascii_uppercase


def main():
    S = stdin.readline().rstrip()
    if S[0] == 'A':
        if len([x for x in S[2:-1] if x == 'C']) == 1:
            if len(set([x for x in S[1:]]) & set(ascii_uppercase)) == 1:
                print('AC')
                return
    print('WA')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
flag = False
if S[0] == "A":
    count = 0
    for i,j in enumerate(S[2:-1]):
        if j == "C":
            count+=1
            ind = i+2
    if count == 1:
        tmp = S[1:ind]+S[ind+1:]
        if tmp == tmp.lower():
            flag = True
            
if flag:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:

def calc(S):
	S = list(S)
	if S[0] == 'A' and S[2:-1].count('C') == 1:
		S[0] = 'a'
		idx = S[2:-1].index('C')
		S[2+idx] = 'c'
		for i in S:
			if i < 'a' or 'z' < i:
				return False
	else:
		return False
	return True
	
inp = raw_input()
print 'AC' if calc(inp) else 'WA'

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

S = input()

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

print('WA')

Submission status: Accepted

Solution code:
s = input()

if s[0] == 'A':
    count = 0
    idx = -1
    for i, ss in enumerate(s[2:-1]):
        if ss == 'C':
            idx = i+2
            count += 1
    if count == 1:
        is_small = True
        for ss in s[1:idx]+s[idx+1:]:
            if ord(ss) < 97:
                is_small = False
                break
        if is_small:
            print('AC')
        else:
            print('WA')
        
    else:
        print('WA')
        
else:
    print('WA')

Submission status: Accepted

Solution code:
s = str(input())
ans = "WA"
if s[0] == "A":
    shor = s[2:-1]
    a = shor.count("C")
    if a == 1:
        d = sum(1 for c in s if c.isupper())
        if d==2:
            ans = "AC"
print (ans)

Submission status: Accepted

Solution code:
s = input()

txt = "abcdefghijklmnopqrstuvwxyz"

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

if((s[1] in txt) == False):
    print("WA")
    exit()

count = 0
for i in s[2:-1]:
    if(i == "C"): count += 1
    elif((i in txt) == False):
        print("WA")
        exit()
if(count != 1):
    print("WA")
    exit()

if((s[-1] in txt) == False):
    print("WA")
    exit()

print("AC")

Submission status: Accepted

Solution code:
import sys

s = input()

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

s_list = list(s)

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

s_list.remove('A')
s_list.remove('C')

s = ''.join(s_list)

if s.islower():
  print('AC')
else:
  print('WA')

Submission status: Accepted

Solution code:
s = input()

if s.count('C') != 1:
    print('WA')
    exit()

if s[0]=='A':
    s = s.lstrip('A')
    if 'C' in s[1:-1]:
        s = s.replace('C', '')
        if s.islower() == True:
            print('AC')
            exit()

print('WA')

Submission status: Accepted

Solution code:
s = input()

flag = False

if s[0] == 'A' and s[2:-1].count('C') == 1:
    s = s.replace('A','')
    s = s.replace('C','')
    if s.islower():
        flag = True

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

Submission status: Accepted

Solution code:
s = input()
hoge = s[2:-1].find("C")
count = s[2:-1].count("C")
ss = s.replace("A", "a").replace("C", "c")
if(s[0] == "A" and hoge != -1 and ss.islower() and count == 1):
  print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
import sys

S = input()

cnt = 0
for i in range(len(S)):
	if i == 0 and S[i] != 'A':
		print('WA')
		sys.exit()
	elif i == 0:
		continue
	if i >= 2 and i <= len(S)-2 and S[i] == 'C':
		cnt += 1
	elif S[i].isupper():
		print('WA')
		sys.exit()

if cnt != 1:
	print('WA')
	sys.exit()
	
print('AC')

Submission status: Accepted

Solution code:


def main():
    S = input()

    l = len(S)

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

    i = S.find("C")

    if 1<i and i<l-1:
        pass
    else:
        print("WA")
        return

    sl = list(S)
    sl.pop(i)
    sl.pop(0)

    s = "".join(sl)

    if s.islower():
        print("AC")
        return
    else:

        print("WA")
        return

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()
C_count = 0
C_pos = 0
upper_flag = True
AC_flag = False
if S[0] == 'A':
    for i, c in enumerate(S[2:-1]):
        if c == 'C':
            C_count += 1
            C_pos = i+2
    if C_count == 1:
        for i, c in enumerate(S[1:]):
            if (i+1 != C_pos):
                if c.isupper():
                    upper_flag = False
        if upper_flag:
            print('AC')
            AC_flag = True

if not AC_flag:            
    print('WA')

Submission status: Accepted

Solution code:
def main(S):
    if S[0] == 'A' and S[2:(len(S)-1)].count('C') == 1:
       S = S.replace('A', 'a', 1)
       S = S.replace('C', 'c', 1)
       if S == S.lower():
           print("AC")
       else:
           print("WA")
    else:
        print("WA")
       

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

Submission status: Accepted

Solution code:
S = input()

judge = True

if S[0] != "A":
    judge = False


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

if count != 1:
    judge = False

s = S.replace("A", "", 1)
s = s.replace("C", "", 1)

if not s.islower():
    judge = False

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

Submission status: Accepted

Solution code:
S = input()
flag = True
C = 0
l = len(S)
if not (S[0] == 'A' and 'a' <= S[1] <= 'z' and 'a' <= S[l-1] <= 'z' ):
    flag = False
i = 2
while i < l-1:
    if not 'a' <= S[i] <= 'z':
        if S[i] == 'C':
            C += 1
        else:
            flag = False
    i += 1
if flag and C == 1:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
l = input()
ccount = 0
for i in range(len(l)):
    if i==0 and l[i]!="A":
        print("WA")
        break
    elif i>=2 and i<=len(l)-2:
        if ccount==0 and l[i]=="C":
            ccount = ccount + 1
        elif not(ord(l[i])>=ord("a") and ord(l[i])<=ord("z")):
            print("WA")
            break
        if ccount>=2:
            print("WA")
            break
    elif (i==1 or i==len(l)-1) and not(ord(l[i])>=ord("a") and ord(l[i])<=ord("z")):
            print("WA")
            break
        
    if i==len(l)-1 and ccount==1:
        print("AC")
    elif i==len(l)-1 and ccount!=1:
        print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
r = input()
if r[0] != 'A' or r.count("C") != 1 or r[1] == "C" or r[-1] == "C" or not r.replace("A", "").replace("C", "").islower():
  print("WA")
  exit()
print("AC")

Submission status: Accepted

Solution code:
S = input().strip()
flag =0
if S[0] =='A':
    if S[2:len(S)-1].count('C') == 1:
        if {'B','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'} & set(S) ==set([]):
            flag =1
print('AC' if flag else 'WA')

Submission status: Accepted

Solution code:
s = input()
chrs = 'abcdefghijklmnopqrstuvwxyz'

p1 = (s[0] == 'A')
p2 = (s[2:-1].count('C') == 1)
p4 = (s[1] in chrs)
p5 = (s[-1] in chrs)

p3 = True
C_found = False
for i in range(2, len(s) - 1):
    if not(s[i] in chrs):
        if (s[i] == 'C'):
            if C_found:
                p3 = False
                break
            else:
                C_found = True
        else:
            p3 = False
            break
        
if p1 and p2 and p3 and p4 and p5 and C_found:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
S = list(input())
flag = False
if S[0]=="A":
    S.remove("A")
    if S[1:-1].count("C")==1:
        tmp = S[1:-1]+list(S[-1])
        tmp.remove("C")
        S = S[0:1] + tmp
        if "".join(S).islower():
            flag = True
print("AC" if flag else "WA")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S = input()
if S[0] != 'A':
  print('WA')
  exit()
S = S[1:]
S_mod = S[1:-1]
if S_mod.count('C') != 1:
  print('WA')
  exit()
S = S.replace('C', '')
if not S.islower():
  print('WA')
  exit()
print('AC')

Submission status: Accepted

Solution code:
import sys

S=input()
check=1

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

SLIST=list(S)

if SLIST[1]=="C" or SLIST[len(S)-1]=="C":
    print("WA")
    sys.exit()
    


count=0
for x in SLIST:
    if x=="C":
        count+=1

if count==1 and 0<=S[2:].index("C")<=len(S)-4:
    True
else:
    print("WA")
    sys.exit()

for x in SLIST[1:]:
    if 97<=ord(x)<=122 or x=="C":
        True
    else:
        print("WA")
        sys.exit()

print("AC")

Submission status: Accepted

Solution code:
S = input()
def f():
    if S[:1] != 'A':
        return False
    t = S[2:-1]
    if t.count('C') != 1:
        return False
    i = t.find('C')
    u = S[1:2+i] + S[2+i+1:]
    if u.lower() != u:
        return False
    return True
    
print("AC" if f() else "WA")

Submission status: Accepted

Solution code:
# import platform
# ver = platform.python_version_tuple()
# if int(ver[1]) < 5:
#     from fractions import gcd
# else:
#     from math import gcd

# from itertools import accumulate, combinations, permutations, product
# from bisect import bisect, bisect_left
# from collections import Counter, defaultdict, deque
# from heapq import heappush, heappop

# from decimal import *
# getcontext().prec = 500

# import string
# string.ascii_lowercase # 定数

# from functools import lru_cache, reduce
# @lru_cache(maxsize=1024)

from sys import stdin, stdout

input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    S = input()

    r = len(S) - 1
    if S[0] != 'A' or S[2:r].count('C') != 1:
        write('WA\n')
        return
    s = S.lower()
    diff = 0
    for i in range(1, len(S)):
        if s[i] != S[i]:
            diff += 1

    if diff == 1:
        write('AC\n')
    else:
        write('WA\n')

main()

Submission status: Accepted

Solution code:
s = input()

f = 1
c = 0

for i in range(len(s)):
    on = 0
    if i==0:
        if not s[i]=='A':
            f = 0
        else:
            on = 1
    elif i>=2 and i<=len(s)-2:
        if s[i] == 'C':
            c += 1
            on = 1
            
    if on == 0 and s[i].islower()==False:
        f = 0
        
if c!=1:
    f=0
    
if f==0:
    print("WA")
else:
    print("AC")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()

if S[0]!='A' or S[1].isupper():
  print('WA')
  exit()
  
Ccount=0
for i in range(2,len(S)):
  if S[i]=='C' and i!=(len(S)-1):
    if Ccount==0:
      Ccount+=1
    else:
      print('WA')
      exit()
  elif S[i].isupper():
    print('WA')
    exit()
if Ccount==1:
  print('AC')
else:
  print('WA')

Submission status: Accepted

Solution code:
S = input()

if S[0] != 'A':
    # print('A', S[0])
    print('WA')
    exit(0)

substr = S[2:-1]

num_C = substr.count('C')


if num_C != 1:
    # print("substr=", substr)
    # print('num_C', num_C)
    print('WA')
    exit(0)


for i, c in enumerate(S):
    if i == 0:
        continue
    if c == 'C':
        continue
    if c.islower():
        continue
    else:
        # print("notlower=", c)
        print('WA')
        exit(0)

print('AC')

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
s = s.replace('A', '', 1)
s = s.replace('C', '', 1)
if not s.islower():
    print("WA")
    exit()
if cnt != 1:
    print("WA")
else:
    print("AC")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()

flag = True

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

if "C" not in s[2:-1]:
    print("WA")
    exit()

idx = s[2:-1].find("C")+2

s = s[1:idx]+s[idx+1:]

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

Submission status: Accepted

Solution code:
S = input()


def judge(S):
    if S[0] != "A":
        return "WA"
    else:
        if S[2:len(S) - 1].count("C") != 1:
            return "WA"
        else:
            for i in range(1, len(S)):
                if S[i] != "C"and S[i].isupper():
                    return "WA"
            return "AC"


print(judge(S))

Submission status: Accepted

Solution code:
s = input()
ans = "AC"
c = 1
for i in range(0,len(s)):
    if i == 0:
        if s[0] != "A":
            ans = "WA"
            break
    if i >= 2 and i < len(s) -1:
        if s[i] == "C":
            c -= 1
            continue
    if i > 0:
        if not s[i].islower():
            ans = "WA"
if c != 0:
    ans = "WA"
print(ans)

Submission status: Accepted

Solution code:
S = input()

count = 0
boo = False
if S[0] != 'A':
    print ('WA')
else:
    if S[1].islower() == False:
        print('WA')
    else:
        if S[-1].islower() == False:
            print ('WA')
        else:
            for str_ in S[2:-1]:
                if str_ == 'C':
                    count += 1
                else:
                    if str_.islower() == True:
                        pass
                    else:
                        boo = True

            if count == 1 and boo == False:
                print ('AC')
            else:
                print ('WA')

Submission status: Accepted

Solution code:
s = list(input())
ans = 0
if s[0] == "A":
    ans += 1
C_ind = []
for i in range(2,len(s)-1):
    if s[i] == "C":
        C_ind.append(i)
if len(C_ind) == 1:
    ans += 1
    del s[C_ind[0]]

S = "".join(s[1:])

if S.islower():
    ans += 1

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

Submission status: Accepted

Solution code:
s=input()

t=len(s)

A=ord("A")
Z=ord("Z")
f=0
for a,i in enumerate(s):
    if a==0:
        if i!="A":
            print("WA")
            exit()
    elif a==1:
        if A<=ord(i)<=Z:
            print("WA")
            exit()
    elif a<t-1:
        if (i=="C" and f==1) or (A<=ord(i)<=Z and i!="C"):
            print("WA")
            exit()
        elif i=="C" and f==0:
            f=1
    else:
        if A<=ord(i)<=Z:
            print("WA")
            exit()
print("AC" if f==1 else "WA")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
S=input()

ans = "WA"

#for i in S:
#    print(i.isupper())
#print(S[2:-1])

if S[0] == "A":
#    print("1ok")
    d=0
    for j in S[2:-1]:
        if j == "C":
            d+=1
    if d == 1:
#        print("2ok")
        c=0
        for i in S:
            if i.isupper() == True:
                c+=1
        if c == 2:
            ans = "AC"
#            print("3ok")
        
print(ans)

Submission status: Accepted

Solution code:
s = input()

aFlag = False
cFlag = False
otherFlag = False
if s[0] == 'A':
    aFlag = True
ccount = 0
for x in s[2:-1]:
    if x == 'C':
        ccount += 1
if ccount == 1:
    cFlag = True

s = s.replace('A', '')
s = s.replace('C', '')
if s.islower():
    otherFlag = True
if aFlag and cFlag and otherFlag:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
f1=False
f2=False
f3=True
s = list(input())
if s[0]=='A':
  f1=True
if s[1].isupper():
  f3=False
for i in s[2:-1]:
  if f3==False:
    break
  if i=='C':
    if f2==True:
      f3=False
    else:
      f2=True
  elif i.isupper():
    f3=False
if s[-1].isupper():
    f3=False
if f1 and f2 and f3:
  s='AC'
else:
  s='WA'
print(s)

Submission status: Accepted

Solution code:
S=list(input())
sw = 0
if S[0] != "A":
    print("WA")
    sw = 1
elif S[2:-1].count("C") != 1:
    print("WA")
    sw = 1
else:
    A = set(S) - set(["A","C"])
    for i in A:
        if i.isupper():
            print("WA")
            sw = 1
            break
if not sw:
    print("AC")

Submission status: Accepted

Solution code:
S = input()
res  = 'WA'
if S[0] == "A":
    counter = 0
    if len(S) > 4:   
        for i  in S[2:-1]:
            if i =='C':
                counter += 1
    else:
        if S[2] =='C':
            counter =1
    if counter == 1:
        low = 0
        big = 0
        for i in S:
            if i.islower():
                low += 1
            else:
                big += 1
        if big == 2:
            res = 'AC'
print(res)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S = list(input())

if S[0] != 'A' or S[1] == 'C' or S[-1] == 'C':
    print("WA")
else:
    if S.count('C') == 1:
        flag = True
        for s in S[1:]:
            if s.isupper() and s !='C':
                print("WA")
                flag = False
                break
        if flag:   
            print("AC")
    else:
        print("WA")

Submission status: Accepted

Solution code:
import string

s = input()

ans = True
if s[0] != 'A':
    ans = False
elif s[2:-1].count('C') != 1:
    ans = False
else:
    lowers = string.ascii_lowercase
    pos_c = s.find('C')
    for i in range(1, len(s)):
        if i != pos_c:
            if s[i] not in lowers:
                ans = False
                break

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

Submission status: Accepted

Solution code:
s = raw_input()

ok = True
if s[0] != "A":
    ok = False
cnt = 0
for i in s[2:-1]:
    cnt += int(i == "C")
if cnt != 1:
    ok = False
for i in s:
    if i != "C" and i != "A" and i.isupper():
        ok = False
if ok:
    print "AC"
else:
    print "WA"

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:

def main():
    s = input()


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

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

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

    if s.islower() == False:
        print("WA")
        exit()

    print("AC")



if __name__ == "__main__":
        main()