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:
def main():
    a = input()
    tmp = 0
    pos = 0
    if a[0] == 'A':
        for i in range(2, len(a)-1):
            if a[i] == 'C':
                tmp += 1
                pos = i
        if tmp == 1:
            for i in range(len(a)):
                if i != 0 and i != pos:
                    if a[i].isupper():
                        print('WA')
                        return
            print('AC')
            return
    print('WA')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

cA = S[0:1] == "A"
cC = False
if(S[2:-1].count("C") == 1):
    A = S[1:2] + S[2:-1].replace("C", "") + S[-1:]
    # print(S)
    cC = A.islower()
if(cA and cC):
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s_list = list(input())
s_list1 = s_list[1:]
count = 0

if s_list[0] == "A":
    del s_list[:2], s_list[-1]
    for i in range(len(s_list)):
        if s_list[i] == "C":
            count += 1
            isC = i + 1
    if count != 1:
        print("WA")
    else:
        del s_list1[isC]
        Str = "".join(s_list1)
        if Str.islower():
            print("AC")
        else:
            print("WA")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = input()
L = len(S)
Flag = True
if not S[0] == 'A':
    Flag = False
cnt = 0
a = str(S[1])
for i in range(2,L-1):
    if S[i] == 'C':
        cnt += 1
    else:
        a += S[i]
a += S[-1]
if a.islower() and cnt == 1:
    pass
else:
    Flag = False
if Flag:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
S=input()
if S[0] != "A":
  print("WA")
elif len([i for i in S[2:-1] if i == "C"]) != 1:
  print("WA")
elif len([i for i in S if i.islower()]) != len(S)-2:
  print("WA")
else:
  print("AC")

Submission status: Accepted

Solution code:
a = list(input())
if a[0] == 'A' and a[1].islower() and a[len(a)-1].islower():
    a = a[2:len(a)-1]
    c_cnt = 0
    ng_f = 0
    for i in range(len(a)):
        if a[i] == 'C':
            c_cnt = c_cnt + 1
        else:
            if not a[i].islower():
                ng_f = 1
                break
    if ng_f == 0 and c_cnt == 1:
        print("AC")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = list(input())
flagx = 0
flagy = 0
if S[0] == "A":
  S.pop(0)
else:
  flagx = 1
  
for i in range(1,len(S)-1):
  if S[i] == "C":
    S.pop(i)
    flagy = 0
    break
  else:
    flagy = 1
    
if str(S).islower() and flagx == 0 and flagy == 0:
  print("AC")
else:
  print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
string = input()
answer = True

if(not string.count('C') == 1 or not string[0] == 'A'):
    answer = False
for i in range(len(string)):
    if(string[i] == 'A'):
        if(i != 0):
            answer = False
            break;
    elif(string[i] == 'C'):
        if(i<2 or i == len(string)-1):
            answer = False
            break;
    elif(string[i].islower() == False):
        answer = False
        break;

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

Submission status: Accepted

Solution code:
import re

S = input()

regex = r'A[a-z][a-z]*C[a-z]*[a-z]'
ans = re.match(regex, S)
if(ans != None):
    if(ans.span() == (0, len(S))):
        print('AC')
    else:
        print('WA')
else:
    print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

S = input()

n = len(S)

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

Submission status: Accepted

Solution code:
def d(s):
    try:
        assert s[0] == 'A'
        assert s[2:-1].count('C') == 1
        assert s[1:].count('C') == 1
        cs = set(s[1:]) - {'C'}
        assert 'a' <= min(cs)
        assert max(cs) <= 'z'
    except AssertionError:
        return False
    else:
        return True


s = raw_input()
if d(s):
    print 'AC'
else:
    print 'WA'

Submission status: Accepted

Solution code:
S = str(input())
if S[0] == "A":
    S = "a" + S[1:]
    if "C" in S[2:-1]:
        cs = False
        for i,s in enumerate(S[2:-1]):
            if not(cs) and s == "C":
                S = S[:i+2] + "c" + S[i+3:]
                cs = True
        if S.islower():
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

Solution code:
S=input()
lis=list(S)
flag=True
while True:
    if lis[0]!="A":
        flag=False
        break
    Q=lis[1].islower()
    if Q==False:
        flag=False
        break
    W=lis[-1].islower()
    if W==False:
        flag=False
        break
    if "C" not in lis:
        flag=False
        break
    else:
        lis.remove("C")
        lis.remove("A")
    if lis==[]:
        flag=True
        break
    mojiretu=''
    for x in lis:
        mojiretu+=x
    Z=mojiretu.islower()
    if Z==True:
        break
    else:
        flag=False
        break
if flag==True:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
from sys import stdin                                                                                                                                                                                       
s = stdin.readline().rstrip()                                                                                                                                                                               
a = s[2:-1]                                                                                                                                                                                                 
cnt = a.count("C")                                                                                                                                                                                          
index = s.find("C")                                                                                                                                                                                         
b = s[1:index]                                                                                                                                                                                              
c = s[index + 1:]                                                                                                                                                                                           
if s[0] == "A" and cnt == 1 and (b.islower() and c.islower()):                                                                                                                                              
    print("AC")                                                                                                                                                                                             
else:                                                                                                                                                                                                       
    print("WA")

Submission status: Accepted

Solution code:
import re
S = input()

flag = 0
if S[0] == "A":
    for i in S[2:-1]:
        if i == "C":
            flag += 1
    if flag == 1:
        if len(re.findall(r'[A-Z]',S)) == 2:
            print("AC")
            quit()
print("WA")

Submission status: Accepted

Solution code:
s = list(input())
l = len(s)
if s[0] == 'A':
    c_cnt = 0
    cn_l = []
    for i, m in enumerate(s):
        if 1<i<l-1 and m=='C':
            cn_l.append(i)
            c_cnt += 1
    if c_cnt == 1:
        cn = int(cn_l[0])
        tmp = s
        tmp.pop(0)
        tmp.remove('C')
        tmp_s = ''.join(tmp)
        if tmp_s == tmp_s.lower():
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')

Submission status: Accepted

Solution code:
import string
write = input()
lis = list(write)
judge = 0
if write[-1] in string.ascii_uppercase or write[1] in string.ascii_uppercase:
    print("WA")
elif write[0] == "A" and write[2:-1].count("C") == 1:
    lis.pop(lis.index("A"))
    lis.pop(lis.index("C"))
    for i in lis:
        if i in string.ascii_lowercase:
            judge += 1    
    if judge == len(lis):
        print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
import re

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())

ans = "AC"

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

if 3 <= s.find('C')+1 <= len(s)-1:
    pass
else:
    ans = "WA"

# C が無いときはこっちで弾ける
if s.find('C') != s.rfind('C'):
    ans = "WA"


index_c = s.find('C')
tmp = s.replace("A", "a")

lower_cases = tmp.replace("C", "c")
if lower_cases != s.lower():
    ans = "WA"




print(ans)

Submission status: Accepted

Solution code:
import  re
S = input()

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

Submission status: Accepted

Solution code:
N = input()

A = N[0:2]
C = N[2:-1]
M = N[-1]


if A[0] == "A":
    if A[1].islower():
        if C.find("C") != -1:
            c = list(C)
            c[C.find("C")] = "s"
            C = "".join(c)
            if C.islower():
                if M.islower():
                    print("AC")
                else:
                    print("WA")
            else:
                print("WA")
        else:
            print("WA")
    else:
        print("WA")       
else:
    print("WA")

Submission status: Accepted

Solution code:
S = input()

ans = 'AC'
c_cnt = 0
c_idx = []
for i in range(2, len(S)-1):
    if(S[i] == 'C'):
        c_cnt += 1
        c_idx.append(i)

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

if(c_cnt != 1):
    ans = 'WA'

if(c_cnt == 1):
    for i in range(1, len(S)):
        if(i == c_idx[0]):
            continue
        if(S[i].isupper() is True):
            ans = 'WA'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()

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

Submission status: Accepted

Solution code:
s=input()
result=""
count=0
l=len(s)
if s[0]!="A":
  result="WA"
elif ord(s[1:2])<97 or ord(s[l-1])<97:
  result="WA"
for i in s[2:l-1]:
  if ord(i)<97:
    count+=1
  if ord(i)<97 and i!="C":
    result="WA"
    break
  if count>1:
    result="WA"
    break
if count==0:
  result="WA"
if result!="WA":
  result="AC"
print(result)

Submission status: Accepted

Solution code:
letters = input()
C = letters[2:-1]
D = letters.replace("A","a").replace("C","c")

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

Submission status: Accepted

Solution code:
a = input()
if a[0] == 'A':
	cnum = 0
	location = 0
	for i in range(2, len(a) - 1):
		if a[i] == 'C':
			cnum += 1
			location = i
	if cnum == 1:
		if a[1:location] + a[location + 1:] == (a[1:location] + a[location + 1:]).lower():
			print ('AC')
		else:
			print ('WA')
	else:
		print('WA')
else:
	print('WA')

Submission status: Accepted

Solution code:
s = str(input())
result = 'WA'
if s[0] == 'A':
    s = s[1:]
    flg = s[1:-1].find('C')
    if flg != -1:
        s = s[:flg + 1] + s[flg + 2:]
        if s[:-1].find('C') == -1 and str(s).islower():
            result = 'AC'
print(result)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()
flag = True
c = 0
if s[0] != "A":
    flag = False
else:
    s = list(s)
    s[0] = "a"
    s = "".join(s)
    for i in range(2, len(s)-1):
        if s[i] == "C":
            s = list(s)
            s[i] = "c"
            s = "".join(s)
            c += 1
    if c != 1:
        flag = False
    else:
        t = s.lower()
        if t != s:
            flag = False



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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
S=input()
judge1=False
judge3=0
judges=len(S)-2
if S[0]=='A':
    judge1=True
for i in range(len(S)):
    if S[i].islower():
        judges=judges-1
for j in range(2,len(S)-1):
    if S[j]=='C':
        judge3=judge3+1
if judge1==True and judge3==1 and judges==0:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
i = input()

flag = i[2:-1].count("C")

if i[0] is not "A":
    flag = 0

import re
if re.findall("A[a-z][a-z,C]{"+str(len(i)-3)+"}[a-z]",i) and (flag == 1):
    print("AC")

else:
    print("WA")

Submission status: Accepted

Solution code:
# vim: set fileencoding=utf-8 :
s = str(raw_input())

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

Submission status: Accepted

Solution code:
import sys

in_str=input()
in_str1=list(in_str)

flag1=-1
flag2=-1

if in_str[0]=='A':
    flag1=0
    
if in_str[2:-1].count("C")==1:
    flag2=2+in_str[2:-1].index("C")
    
if flag1!=-1 and flag2!=-1:
    in_str1[flag1]="a"
    in_str1[flag2]="c"
    in_str2=list(in_str.lower())
    if in_str1==in_str2:
        print("AC")
        sys.exit()
print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
if 'A' not in S or 'C' not in S:
    print('WA')
else:
    if S.find('A') != 0:
        print('WA')
    else:
        T = S.replace('A', 'a', 1)
        if T.find('C') == 1 or T.rfind('C') == len(S)-1:
            print('WA')
        else:
            U = T.replace('C', 'c', 1)
            if U.islower() == False:
                print('WA')
            else:
                print('AC')

Submission status: Accepted

Solution code:
a = input()
a_list = list(a)
l = len(a)
count = 0
if a_list[0] == "A" and a_list[1].islower() and a_list[l-1].islower():
  for i in range(l-3):
    if a_list[i+2] == "C":
         count = count+1
    elif a_list[i+2].isupper():
        print("WA")
        exit()
if count == 1:
    print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
s = str(input())
i = len(s)

sc = s.lstrip("A")
sb = sc.replace("C", "")

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

else:
    print("WA")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3


def main():
    S = list(input())
    judge = True
    if S[0] == "A":
        S[0] = S[0].lower()
    else:
        judge = False
    if S[1] == "C":
        judge = False
    if S[2:-1].count("C") == 1:
        for n, i in enumerate(S):
            if 2 <= n <= len(S) - 1:
                if i == "C":
                    S[n] = S[n].lower()
    else:
        judge = False
    if S[-1] == "C":
        judge = False
    S = "".join(S)
    if S.islower() == False:
        judge = False
    if judge:
        print("AC")
    else:
        print("WA")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

a=int(0)
c=int(0)
x=int(0)

if s[0]=='A':
    s='a'+s[1:len(s)]
    a=1

for i in range(2,len(s)-1):
    if a==0:
        break
    if s[i]=='C':
      s=s[:i]+'c'+s[i+1:]
      c=1
      break

t=s.lower()

if a==1:
    if c==1:
        if t==s:
            print('AC')
            x=1
if x==0:
    print('WA')

Submission status: Accepted

Solution code:
moji = input()
moji_split = [moji[i:i+1] for i in range(len(moji))]
moji_middle = []
flag1 = False
flag2 = False
flag3 = False

if moji_split[0] == "A":
    flag1 = True

for i in range(2, len(moji_split)-1):
    moji_middle += moji_split[i]
if moji_middle.count("C") == 1:
    flag2 = True

while "A" in moji_split:
    moji_split.remove("A")
while "C" in moji_split:
    moji_split.remove("C")
if "".join(moji_split).islower() ==True:
    flag3 = True
    
if flag1 == True and flag2 == True and flag3 == True:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = list(input())
S1 = S[2:-1]
ans = 'WA'
if S[0] == 'A':
    if S1.count('C') == 1:
        S2 = S[1:]
        S2.remove('C')
        L = ''.join(S2)
        if L.isalpha() == True & L.islower() == True:
            ans = 'AC'

print(ans)

Submission status: Accepted

Solution code:
s = list(input())

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

Submission status: Accepted

Solution code:

import re

s = input()

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

Submission status: Accepted

Solution code:
def main():
    S = raw_input()

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

main()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

line = list(input())
mid = [ line[i] for i in range(2,len(line)-1)]
line2 = [ line[i] for i in range(len(line))]
if "C" in line2 and "A" in line2 :
    line2.remove("A")
    line2.remove("C")


#print(line)
#print(mid)

if line[0] == "A" and mid.count("C") == 1 and ''.join(line2).islower() :
    print("AC")
else:
    print("WA")



#S の先頭の文字は大文字の A である。
#S の先頭から 3 文字目と末尾から 2 文字目の間（両端含む）に大文字の C がちょうど 1 個含まれる。
#以上の A, C を除く S のすべての文字は小文字である。

Submission status: Accepted

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

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

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

err=0
for s in S:
 if s < 'a' or s >'z':
  err +=1
 
if err !=2:
 ans ="WA"

print(ans)

Submission status: Accepted

Solution code:
s=input()
end_flag=0

if ((s[0]!="A")or(s.count("C")!=1)):
  end_flag=1
elif (s[1]=="C")or(s[-1]=="C"):
  end_flag=1

if (s.count("B")!=0)or(s.count("D")!=0)or(s.count("E")!=0):
  end_flag=1
if (s.count("F")!=0)or(s.count("G")!=0)or(s.count("H")!=0):
  end_flag=1
if (s.count("I")!=0)or(s.count("J")!=0)or(s.count("K")!=0):
  end_flag=1
if (s.count("L")!=0)or(s.count("M")!=0)or(s.count("N")!=0):
  end_flag=1
if (s.count("O")!=0)or(s.count("P")!=0)or(s.count("Q")!=0):
  end_flag=1
if (s.count("R")!=0)or(s.count("S")!=0)or(s.count("T")!=0):
  end_flag=1
if (s.count("U")!=0)or(s.count("V")!=0)or(s.count("W")!=0):
  end_flag=1
if (s.count("X")!=0)or(s.count("Y")!=0)or(s.count("Z")!=0):
  end_flag=1

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

Submission status: Accepted

Solution code:
s = input()
count = 0
for i in range(len(s)):
    if i == 0:
        if s[i] != 'A':
            break
    elif i == 1:
        if s[i].islower():
            pass
        else:
            break
    elif i>1 and i < len(s)-1 :
        if s[i]=='C':
            if count == 0:
                count += 1
            else:
                break
        elif s[i].islower():
            pass
        else:
            break
    elif i == len(s)-1 :
        if s[i].islower():
            if count ==1:
                print("AC")
                exit()
print("WA")

Submission status: Accepted

Solution code:
S=list(input())
length = len(S)
z1 = 0
z2 = 0
z3 = 0
if S[0] == "A":
    z1 = 1

for i in range(2,length-1):
    if S[i] == "C":
        z2 = z2 + 1

for i in range(length):
    if S[i].islower()==False:
        z3 = z3 + 1       

if [z1,z2,z3] == [1,1,2]:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
S = input()

a = S.count('A')
c = S[2:-1].count('C')

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

Submission status: Accepted

Solution code:
S = input()

a = S[0] == 'A'
b = S[2:-1].count('C') == 1
if a and b:
    S = list(S)
    S_1 = S[2:-1]
    S_1.remove('C')
#    print(S[0:2])
#    print(S_1)
#    print(S[-1:])
    S = S[0:2] + S_1 + S[-1:]
    del S[0]
#    print(S)
    c = str(S).islower()

if a and b and c:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
import re

S = str(input())

ans = "AC"

uppercount = len(re.findall('[A-Z]', S))
if not uppercount == 2:
    ans = "WA"

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

cfind = S[2:-1].find("C")
if cfind < 0:
    ans = "WA"

if not S[1:cfind+2].islower and S[cfind+3:].islower():
    ans = "WA"

print(ans)

Submission status: Accepted

Solution code:
import sys

S = input()
C_count = 0
flag = True

if(S[0] == 'A'):
  for i in range(2, len(S)-1):
    if(S[i] == 'C'):
      C_count += 1
      C_i = i
  if(C_count == 1):
    for i in range(1, len(S)):
      if(i != C_i):
        if(S[i].isupper()):
          flag = False
    if(flag):
      print("AC")
      sys.exit()
print("WA")

Submission status: Accepted

Solution code:
S = input()
CountC = S[2:-1].count('C')
WhereC = S.find('C')

if S[0]=='A' and CountC == 1 and S[1:WhereC].islower()==True and S[WhereC+1:].islower()==True:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
s=input()
#l=[]
#for ss in s:
#    l.append(ss)
q=0
if s[0]=="A":
    w=0
    for ss in s[2:-1]:
        if ss=="C":
            w+=1
#            l.remove(ss)

    if w==1:
        for ss in s[1:]:
            if ss=="C":
                continue
            elif ss==ss.lower() :
                continue
            else:
                q=1
                break
    else:
        q=1
else:
    q=1

if q==0:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = input()

if S[0] != 'A':
    print('WA')
    quit()
if S[2:-1].count('C') != 1:
    print('WA')
    quit()
if not all(i.islower() for i in S[1:].replace('C','')):
    print('WA')
    quit()
print('AC')

Submission status: Accepted

Solution code:
s = input()
smalls = "abcdefghijklmnopqrstuvwxyz"
def solve(s):
    count = 0
 
    if s[0] != "A":
        return False
 
    if s[1] not in smalls:
        return False
    for char in s[2:-1]:
        if char == "C":
            count += 1
            continue
 
        if char not in smalls:
            return False
    if count != 1:
        return False
    if s[-1] not in smalls:
	    return False
    return True
 
if solve(s):
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
import sys

s = input()
t = "abcdefghijklmnopqrstuvwxyz"

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

st = s[2:-1]
if st.count('C') != 1:
    print('WA')
    sys.exit(0)
p = s.find('C')

for i in range(1,len(s)):
    if i == p:
        continue
    elif t.find(s[i]) >= 0:
        continue
    else:
        print('WA')
        sys.exit(0)

print('AC')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

S.pop(0)
S.pop(S.index('C'))

for string in S:
    if not string.islower():
        print('WA')
        sys.exit()

print('AC')

Submission status: Accepted

Solution code:
s = input()

b = s[2:len(s)-1]
c = s.replace('A','').replace('C','')

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

elif b.count('C') != 1 :
   print('WA')

elif c!=c.lower() :
   print('WA')

else :
   print('AC')

Submission status: Accepted

Solution code:
lC = ['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']

def solve(S):
    if not(S[0] == 'A'):
        return "WA"
    if S[-1] == 'C':
        return "WA"
    if not(S[1] in lC):
        return "WA"
    
    flag = False
    for i in range(1,len(S)):
        if S[i] == 'C':
            if flag:
                return "WA"
            flag = True
            continue
        if not(S[i] in lC):
            return "WA"
    if not(flag):
        return "WA"
    return "AC"
    

S = input()
print(solve(S))

Submission status: Accepted

Solution code:

def B():
    s = input()    
    WA = 'WA'
    AC = 'AC'
    result = AC
    
    if s[0] != 'A':
        result = WA
    
    a_cnt=2
    C_count=0
    C_nsub=""
    for a in s[2:-1]:
        a_cnt += 1
        if a=='C':
            C_count += 1
            C_nsub = s[1:a_cnt-1] + s[a_cnt:]
    
    if C_count!=1 and result==AC:
        result = WA
    
    if not C_nsub.islower() and result==AC:
        result = WA
    
    print (result)

if __name__ =='__main__':
    B()

Submission status: Accepted

Solution code:
s=input()
n=len(s)
count=0
flag=0
i=1
list="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for chara in s:
    if i==1:
        if chara!="A":
            flag=2
            break
    elif i==2:
        if chara in list:
            flag=2
            break
    elif i>=3 and i<=n-1:
        if chara=="C":
            count+=1
            if count==1:
                flag=1
            elif count==2:
                flag=2
                break
    elif i==n:
        if chara in list:
            flag=2
            break
    i+=1
            
if flag==1:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()
s.split()
length = len(s)
i = 2
f1 = 0
f2 = 0
i2 = 1
f2 = 1
f3 = 0
if s[0] == "A":
    while i < length - 1:
        if s[i] == "C":
            f1 = i
        i = i + 1
    if f1 > 0:
        f2 = 0
        while i2 < length:
            if ord(s[i2]) < 91 and i2 != f1:
                f2 = 1
            i2 = i2 + 1
    if f2 == 0:
        print("AC")
        f3 = 1
if f3 == 0:
    print("WA")

Submission status: Accepted

Solution code:
import re
s=input()
flag=False
c=0
d=0
for i in s:
    if(re.search('[A-Z]',i)):d+=1
for i in range(2,len(s)-1):
    if(s[i]=='C'):c+=1
    # print(s[i])
if(s[0]=='A' and c==1 and d==2):print('AC')
else:print('WA')

Submission status: Accepted

Solution code:
S = str(input())
if S[0] == "A" and S[2:len(S)-1].count("C") == 1 and S[1:].split("C")[0].islower() == True and S[1:].split("C")[1].islower() == True:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()


def lower_checker(ss):

    for k in ss:
        if k != 'A' and k != 'C' and k.islower() is False:
            return False
    return True

def C_counter(ss):
    cnt = 0
    for k in ss:
        if k == 'C':
            cnt += 1
    if cnt == 1:
        return True
    else:
        return False

flag = True
if s[0] != 'A':
    flag = False
if flag is False or C_counter(s[2:-1]) is False:
    flag = False
if flag is False or lower_checker(s) is False:
    flag = False

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def check(str):
	cnt = 0
	for s in str:
		if s.islower():
			cnt += 1
	return cnt == len(str) - 1 and str.find('C') != -1

S = input()

if S[0] == 'A' and S[1] != 'C' and S[len(S) - 1] != 'C' and check(S[2:len(S) - 1]) and S[1].islower() and S[len(S) - 1].islower():
	print('AC')
else:
	print('WA')

Submission status: Accepted

Solution code:
s=input()
if s[0]!='A':print('WA')
elif not(1==s[2:-1].count('C')==s.count('C')):print('WA')
else:t=s.find('C');s=s[1:t]+s[t+1:];print('AC'if s==s.lower()else'WA')

Submission status: Accepted

Solution code:
s = input()
count = 0
for i in range(2, len(s)-1):
    if s[i] == 'C':
        count = count + 1
        s = s[:i] + 'c' + s[i+1:]
    else:
        continue
if s[0] != 'A':
    flag = False
elif count != 1:
    flag = False
else:
    s = 'a' + s[1:]
    flag = s.islower()
if flag:
    print('AC')
else:
    print('WA')