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:
s = input()

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

c = 0

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

if s.islower():
    ansFlg += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#Sを取得
s = input()

#1文字目を取り出す
s1 = s[0]

#3文字目と末尾から2文字目の間の文字列を取り出す。
s2 = s[2:-1]

#AとCを元の文字列から消しちゃう。
s = s.replace('A','')
s = s.replace('C','')

#sを全て小文字に変換した文字列を用意する。
#これとsが一致したら、sはもともと全部小文字だったことになる。
t = s.lower()

if(s1 == 'A' and s2.count('C') == 1 and t == s):    #1文字目がAで、Cの数が1個だけで、それ以外の文字が全て小文字なら
    print('AC')
else:
    print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
s = input()

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

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

print("WA")

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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


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

Submission status: Accepted

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

Submission status: Accepted

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

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

cnt = 0

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

if cnt != 1:
    ans = "WA"

print(ans)

Submission status: Accepted

Solution code:
import sys

class alphabet: #Trueなら大文字
    def __init__(self, capitalize):
        self.num = dict() #アルファベットを数字に変換
        self.abc = ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"\
            ,"o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z")
        if capitalize: 
            for i in range(26): self.abc[i] = self.abc[i].upper()
        for i, a in enumerate(self.abc): self.num[a] = i


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

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

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s = input()
cnt = 0
if s[0] == "A" and s[2:-1].count("C") == 1 and s.replace("A", "").replace("C", "").islower():
    print("AC")
else:
    print("WA")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 16:16:15 2020

@author: shinba
"""
import sys

s = list(input())

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

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

Solution code:
S = list(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

S = input()

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

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

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

Submission status: Accepted

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

def main():
    S = input()

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

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


main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    S=input()
    tmp=(S[0]=="A")
    f=0
    a=""
    for i in range(1,len(S)):
        if S[i]=="C":
            if i>=2 and i<len(S)-1:
                f=1
                tmp+=1
            else:break
        else:a+=S[i]        
    tmp+=(a.islower())
    print(["WA","AC"][tmp==3])
    
    #print()
#%%submit!
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
S = input()
count = 0
flag = False
if S[0] == "A":
    # print(S[2:-1]) #指定部分獲得できる
    tmp = S[2:-1]
    lower = S[1:]
    for i in range(len(tmp)):
        if tmp[i] == "C":
            count += 1
    if count == 1:
        tmpS = S.replace("A","a")
        tmpSS = tmpS.replace("C","c")
        if tmpSS.islower():
            flag = True

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

Submission status: Accepted

Solution code:
import fileinput

s = list(input())

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

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

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

Submission status: Accepted

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


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

    if count != 1:
        return False

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


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

Submission status: Accepted

Solution code:
s = list(input())

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
s = input()

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

Submission status: Accepted

Solution code:
#ABC104_B
S = input()

ans = "AC"

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
S = list(input())

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

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()
flag = True

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

Submission status: Accepted

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

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

cnt = 0

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

if cnt != 1:
    ans = 'WA'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()

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

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

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

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
S = rs()
N = len(S)
ans = 'AC'
if S[0] != 'A' or S[2:-1].count('C') != 1:
    ans = 'WA'
for i in range(N):
    if not S[i] in ascii_lowercase:
        if not (i == 0 and S[i] == 'A') and not (2 <= i < N - 1 and S[i] == 'C'):
            ans = 'WA'
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    s = input()
    if s[0] == 'A' and s[2:-1].count('C') == 1:
        for char in s:
            if not (char == 'A' or char == 'C' or char.islower()):
                break
        else:
            print('AC')
            exit()
    print('WA')



if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

            

main()

Submission status: Accepted

Solution code:
s = input()


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

    if upper != 2:
        return False
    return True


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

Submission status: Accepted

Solution code:
import re

s = input()


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


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# coding: utf-8

# https://atcoder.jp/contests/abc104
# 16:23-


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

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


print(main())