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()
e = 0
if s[0] == "A":
  for i in range(2,len(s)-1):
    b = s[i]
    if b == "C":
      e = 1
      f = i
      break
  if e == 1:
    s = s[:f] + s[f+1:]
    s = s[1:]
    if s.islower():
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")

Submission status: Accepted

Solution code:
S = input()

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

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

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

for i in range(1, len(S)):
    if S[i] == 'C':
        continue
    if not S[i].islower():
        print("WA")
        exit()
print("AC")

Submission status: Accepted

Solution code:
count=0
s=input()
if s[0]=="A":
  count+=1

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

if (s[1:ci]+s[ci+1:]).islower()==True and count==2:
  print("AC")
else:
  print("WA")
#print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
s = input()

def check(s):
    if len(re.findall('[A-Z]', s)) != 2:
        return False
    if s.find('A') != 0:
        return False
    if s.find('C') < 2 or s.find('C') >= len(s) - 1:
        return False
    return True

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

Submission status: Accepted

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

Submission status: Accepted

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

is_find = False
idx = 0
for i in range(2, len(s)-1):
    if s[i] == 'C':
        if is_find:
            print('WA')
            exit()
        else:
            is_find = True
            idx = i

if is_find == False:
    print('WA')
    exit()

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

if rm_s.lower() == rm_s:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
import string
S = input()

tmp = sum((c == 'C') * 1 for c in S[2:-1])
flag = True
for c in S[:2] + S[-2:]:
    if c in string.ascii_uppercase:
        if c != 'A' and c != 'C':
            flag = False
            break

if S[0] == "A" and tmp == 1 and flag:
    print("AC")
else:
    print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check (S):
    if S[0] != 'A':
        return False
    
    if S[len(S)-1] == 'C':
        return False;

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

    for i in range(1, len(S)):
        if S[i] != 'C' and ('A' <= S[i] and S[i] <= 'Z'):
            return False

    
    return True

S = input()
ans = check(S)
if ans == True:
    print ("AC")
else:
    print ("WA")

Submission status: Accepted

Solution code:
string = input().strip()

def main(string):
    if string[0] != 'A':
        return 'WA'
    if 'C' not in string[2:-1]:
        return 'WA'
    count = 0
    for s in string:
        if s.isupper():
            count += 1
    if count != 2:
        return 'WA'
    return 'AC'

print(main(string))

Submission status: Accepted

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

s1 = S[0]
s2 = S[2:-1]
s3 = S.replace("A","a").replace("C","c")

if s1 == "A" and s2.count("C") == 1 and S.lower() == s3:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s=input()
cnt=0 
for i in s:
    if i.isupper():
        cnt+=1 

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

Submission status: Accepted

Solution code:
string = input()
first = string[0]
second = string[2:-1]
others = string[1]+string[2:].replace('C', '', 1)
if first == 'A' and second.count('C') == 1:
    if others.islower():
        print('AC')
        exit()
print('WA')

Submission status: Accepted

Solution code:
S = input()
flag = True
if S[0] == 'A':
    pass
else:
    flag = False

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

if cnt == 1:
    pass
else:
    flag=False
cnt = 0
for i in range(len(S)):
    if S[i].islower():
        cnt += 1
if cnt == len(S)-2:
    pass
else:
    flag=False
if flag:
    print('AC')
else:
    print('WA')

Submission status: Accepted

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


def main():
    s = input()

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

        if cnt == 1 and s[-1] != "C":
            for i in set(s):
                if i != "A" and i != "C":
                    if ord("a") <= ord(i) <= ord("z"):
                        continue
                    else:
                        print("WA")
                        break
            else:
                print("AC")
        else:
            print("WA")

    else:
        print("WA")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

cnt = 0
if s[0] == 'A' and 'C' in s[2:-1] and s.replace("A","").replace("C","").islower():
    for c in s[2:-1]:
        if c == 'C':
            cnt+=1

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

Submission status: Accepted

Solution code:
#coding:utf-8

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

num_c = 0
for c in s[2:-1]:
    if c == 'C':
        num_c += 1
    else:
        if c.isupper():
            ans = 'WA'
if num_c != 1: ans = 'WA'

if s[-1].isupper(): ans = 'WA'
if s[1].isupper(): ans = 'WA'
print(ans)

Submission status: Accepted

Solution code:
import re

def solve(s):
    if re.match(r"A[a-z]+C[a-z]+$", s):
        return "AC"
    return "WA"


if __name__ == "__main__":
    s = input()
    print(solve(s))

Submission status: Accepted

Solution code:
S = input()

ans = 'WA'

if S[0] == 'A' and S[2:-1].count('C') == 1:
    for s in S:
        if (not (s == 'A' or s == 'C')) and not s.islower():
            break
    else:
        ans = 'AC'

print(ans)

Submission status: Accepted

Solution code:
S = input()


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

    seq = [c for c in S[2:-1] if c == 'C']
    seq2 = [c for c in S[1:] if c != 'C']
    if len(seq) != 1:
        print('WA')
        return

    for c in seq2:
        if c.isupper():
            print('WA')
            return
    print('AC')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = list(input())

f_cd1, f_cd2, f_cd3 = False, False, False
cd3_ng = True
c_cnt, c_idx = 0, -1

if S[0] == 'A' :
    f_cd1 = True
    for i in range(2, len(S) - 1) :
        if S[i] == 'C' :
            c_cnt += 1
            c_idx = i
            
    if c_cnt == 1 :
        f_cd2 = True
        
        for i in range(len(S)) : 
            if (i != 0 and i != c_idx) and S[i] not in list('abcdefghijklmnopqrstuvwxyz') :
                cd3_ng = False
                break
                
        if cd3_ng == True :
            f_cd3 = True
            
if f_cd1 == f_cd2 == f_cd3 == True :
    print("AC")
else :
    print("WA")

Submission status: Accepted

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

    ans = f(S)
    print(ans)


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

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

    import string
    for c in S[1] + S[-1]:
        if c in string.ascii_uppercase:
            return "WA"

    return "AC"


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

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

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

if c != 1:
    ans = 'WA'

for i in range(1, len(S)):
    if i == cc:
        continue

    if S[i].isupper():
        ans = 'WA'

print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S = raw_input()
c1 = (S[0] == 'A')
c2_indexes = []
for i, s in enumerate(S):
    if i < 2 or i == len(S)-1: continue
    if s == 'C': c2_indexes.append(i)
c2 = (len(c2_indexes) == 1)
c3 = True
if c1 and c2:
    for i, s in enumerate(S):
        if i == 0 or i == c2_indexes[0]: continue
        if s.isupper():
            c3 = False
            break
if c1 and c2 and c3:
    print 'AC'
else:
    print 'WA'

Submission status: Accepted

Solution code:
import sys

def solve(s):
	if s[0] != 'A':
		return False


	s2 = s[2:L-1]
	if s2.count("C") != 1:
		return False

	s1 = s[1:].replace("C", "")
	if s1.islower():
		return True

	return False


s = sys.stdin.readline()
s = s.strip()
L = len(s)

flag = solve(s)

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

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
S = input()

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

# assertion 2
count = 0
C_index = None
for i, char in enumerate(S[2:-1], start=2):
    if char == "C":
        count += 1
        C_index = i
    else:
        continue
if count != 1:
    print("WA")
    exit(0)

# assertion 3
discard_indices = {0, C_index}
S_the_others = "".join([char for i, char in enumerate(S) if i not in discard_indices])
if not S_the_others.islower():
    print("WA")
    exit(0)

print("AC")

Submission status: Accepted

Solution code:
from collections import Counter
s=list(input())
c=Counter(s[2:-1])

if s[0]=="A" and c["C"]==1:
  s.remove("A")
  s.remove("C")
  if str(s)==str(s).lower():
    print("AC")
    exit()
print("WA")

Submission status: Accepted

Solution code:
S = input()

if S[0] == 'A':
    S = S[1:]
    count = 0
    for i in range(len(S)-2, 0, -1):
        if S[i] == 'C':
            S = S[:i] + S[i+1:]
            count += 1
    if count == 1:
        if S.islower():
            print('AC')
            quit()
print('WA')

Submission status: Accepted

Solution code:
s=input()
a=0
n=len(s)
for i in range(2,n-1):
    a=1
    if s[i]=="C":
        a=0
        break
if s[0]!="A":
    a=1
t=list(s.lower())
k=list(s)
b=0
for i in k:
    if i not in t:
        b+=1
if b==2 and a==0:
    print("AC")
else:
    print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

flag = True

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

idx = None
for i, s in enumerate(S[2:-1]):
    if s == 'C':
        if idx == None:
            idx = i + 2
        else:
            flag = False

if idx == None:
    flag = False

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

    if s != s.lower():
        flag = False

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

Submission status: Accepted

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

s = input()

alphabets = list("abcdefghijklmnopqrstuvwxyz")

res = True

if s[0] != 'A' or s[1] not in alphabets:
    res = False

count = 0
for i in range(2, len(s)-1):
    if s[i] == 'C':
        if count == 0:
            count = 1
        else:
            res = False
    elif s[i] not in alphabets:
        res = False

if count == 0:
    res = False

if s[len(s)-1] not in alphabets:
    res = False

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

Submission status: Accepted

Solution code:
import sys
s=input()
if s.startswith("A") and s[2:len(s)-1].count("C")==1:
    for i in range(len(s)):
        if s[i]=="C" or s[i]=="A":
            pass
        else:
            if s[i]!=s[i].lower():
                print("WA")
                sys.exit()
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = input()

if S.count("A") == 1 and S.count("C") == 1:
    if S[0] == "A" and 2 <= S.find("C") <= len(S)-2:
        rmS = S.replace("A", "")
        rmS = rmS.replace("C", "")
        if rmS == rmS.lower():
            print("AC")
        else:
            print("WA")
    else:
        print("WA")

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()

dt = list(S)
dt.remove("A")
dt.remove("C")

if "".join(dt).islower():
    print("AC")
    exit()
else:
    print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

if S[0] == 'A':
    if S[2:-1].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")

Submission status: Accepted

Solution code:
S=input()
flag=True
if S[0]=="A":
    if S[2:-1].count("C")==1:
        S=S.replace('A','').replace('C','')
        if S==S.lower():
            flag=True
        else:
            flag=False
    else:
        flag=False
else:
    flag=False
if flag:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
S = input()

mid = list(S[2:-1])
if S[0] != 'A':
    print('WA')
elif mid.count('C') != 1:
    print('WA')
else:
    idx = S[2:-1].index('C')
    test = S[1] + S[2:2+idx] + S[3+idx:]
    if test.islower():
        print('AC')
    else:
        print('WA')

Submission status: Accepted

Solution code:
S = input()
if S[0] == 'A':
    i = S[2:-1].find("C")
    c = S[2:-1].count("C")
    if i != -1 and c == 1:
        i += 2
        for j in range(len(S)):
            if j > 0 and i != j:
                if not ord('a') <= ord(S[j]) <= ord('z'):
                    break
        else:
            print("AC")
            exit(0)
print("WA")

Submission status: Accepted

Solution code:
s = input()


def valid(s):
    if s[0] != 'A':
        return False
    if 'C' not in s[2:len(s)-1] or s[2:len(s)-1].find('C') != s[2:len(s)-1].rfind('C'):
        return False

    _s = s[1:].replace('C', "")
    if not _s.islower():
        return False
    return True


if valid(s):
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()
t = s[2:-1]
if s[0]=='A' and t.count('C')==1:
  c = 0
  for i in s:
    if ord('A')<=ord(i)<=ord('Z'):
      c += 1
  if c==2:
    print('AC')
  else:
    print('WA')
else:
  print('WA')

Submission status: Accepted

Solution code:
# R = int(input())
# a, b = map(int, input().split())
# c = list(map(int, input().split()))
# d = [list(map(int, input().split())) for _ in range(n)]
s = input()

ans = "AC"

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

count = 0

for i in range(len(s)):
    if i == 0:
        continue
    if i >= 2 and i != len(s)-1:
        if s[i] == "C":
            count += 1
        else:
            if s[i].isupper():
                ans = "WA"
    else:
        if s[i].isupper():
            ans = "WA"

if count != 1:
    ans = "WA"

print(ans)

Submission status: Accepted

Solution code:
S = input()
ans = "AC"
l = len(S)
if S[0] != "A":
    ans = "WA"

if len(S[2:-1].replace("C", "")) != l-4:
    ans = "WA"

s = S.replace("C", "").replace("A", "")
if len(s) != l-2 :
    ans = "WA"
if not s.islower():
    ans ="WA"

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

S = input()

if Counter(S[2:-1])['C'] == 1:
    flag = True
else:
    flag = False

T = ''
for s in S:
    if s != 'C':
        T += s

if S[0] == 'A' and flag and T[1:].islower():
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
S = input()
ac = True
if S[0] != 'A':
  ac = False
if S[2:-1].count('C') != 1:
  ac = False
UC = ''
for s in S:
  if ord(s) < 97:
    UC += s
if UC != 'AC':
  ac = False
print('AC' if ac else 'WA')

Submission status: Accepted

Solution code:
s = input()
count = 0
for i in s:
    count += i.isupper()

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

Submission status: Accepted

Solution code:
s  = input()

flag=1
if s[0] != "A":
    flag=0
    
if s[2:-1].count("C") !=1:
#     print(s[2:-1])
    flag = 0
    
b =[]
for _ in s:
    if _ not in ["A", "C"]:
        b.append(_)
    
c = "".join(b)
if c !=  c.lower():
    flag = 0
    
if flag==1:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
import sys
S = list(input())

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

if 'C' not in S[2:-1]:
    print("WA")
    sys.exit()


S.remove('A')
S.remove('C')

if str(S).islower():
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = input()
if S[0] != 'A':
    print('WA')
elif S[2:-1].count('C') != 1:
    print('WA')
else:
    upper = 0
    for c in S:
        if c.isupper():
            upper += 1
    print('AC' if upper == 2 else 'WA')

Submission status: Accepted

Solution code:
s = input()
flag = True
c, d = 0, 0
for i in range(len(s)):
    if i == 0 and s[i] != "A":
        flag = False
        break
    elif 2 <= i <= len(s) - 2 and s[i] == "C":
        c += 1

    if s[i].lower() == s[i]:
        d += 1

if c != 1:
    flag = False

if d != len(s) - 2:
    flag = False

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

Submission status: Accepted

Solution code:
import re

s = input()

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

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

Submission status: Accepted

Solution code:
import re

s = input()

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

Submission status: Accepted

Solution code:
import sys
s = sys.stdin.readline().strip()
ac = True
if s[0] == "A" and s[1].islower():
    n = len(s)
    c = 0
    for i in range(2, n):
        if s[i].isupper():
            if s[i] == "C" and i < n-1: c += 1
            else:
                ac = False
                break
        if c > 1:
            ac = False
            break
    if c != 1: ac = False
else:
    ac = False
print("AC" if ac else "WA")

Submission status: Accepted

Solution code:
t = []
count = 0
t += input()
for i in range(len(t)):
    if i == 0:
        if t[i] != "A":
            count = 2
            break
    elif i == 1 or i == len(t)-1:
        if t[i] == t[i].upper():
            count = 2
            break
    else:
        if t[i] == "C" and count == 0:
            count += 1
        elif t[i] == t[i].upper():
            count = 2
            break
if count == 1:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = input()

if S[0] == "A":
    count = 0
    for c in S[2:-1]:
        if c == "C":
            count += 1

    if count == 1:
        count = 0
        for c in S:
            if str(c).isupper():
                count += 1
        
        if count == 2:
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

Solution code:
from collections import Counter
S = input()
C = Counter(S[2:-1])
patience = 1
for s in S[1:]:
    if s == "C" and patience:
        patience -= 1
        continue
    if s.isupper():
        print("WA")
        exit()

if S[0] == "A" and C["C"] == 1:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = input()

print("AC" if all([
    S.startswith("A"),
    len([c for c in S[2:-1] if c == "C"]) == 1,
    all([c in "abcdefghijklmnopqrstuvwxyz" for c in S[1:] if c != "C"]),
]) else "WA")

Submission status: Accepted

Solution code:
S=input()
flag = 0
for i in range(len(S)-3):
    if S[i+2] == "C":
        flag += 1
flag2 = 0
for s in S:
    if s.upper() == s:
        flag2+=1
if flag == 1 and S[0] == "A" and flag2 == 2:
    print("AC")
else:
    print("WA")

Submission status: Accepted

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


def judge(s):
    if s[0] != "A":
        return False
    a_pos = 0
    c_pos = None
    for i in range(2, len(s) - 1):
        if s[i] == "C":
            if c_pos is not None:
                return False
            c_pos = i
    if c_pos is None:
        return False
    for i, c in enumerate(s):
        if i != a_pos and i != c_pos and not c.islower():
            return False
    return True


def main():
    print("AC" if judge(input()) else "WA")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()

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

ct = {}
for c in S[2:-1]:
  ct[c] = ct.get(c, 0) + 1

if ct.get('C', 0) != 1 or S[-1].isupper():
  print('WA')
  exit()

print('AC')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

alpha = 'abcdefghijklmnopqrstuvwxyz'
ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

ans = True

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

c_cnt = 0
for S_i in S[2:-1:]:
    if S_i == 'C':
        c_cnt += 1
if c_cnt != 1:
    ans = False

for S_i in S[1:]:
    if S_i in ALPHA and S_i != 'C':
        ans = False

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

Submission status: Accepted

Solution code:
S = input()
ans = 'WA'
from string import ascii_lowercase
if S[0] == 'A' and S[2:-1].find('C') != -1:
    j = S.find('C')
    k = 0
    for i,s in enumerate(S):
        if i == 0 or j == i:continue
        if s in ascii_lowercase:
            k += 1
    if k == len(S) - 2:
        ans = 'AC'
print(ans)

Submission status: Accepted

Solution code:
s = input()

res=True
if s[0] != "A":
    res = False
cnt=0
for c in s[2:-1]:
    if c=="C":cnt+=1
if cnt != 1:
    res = False

big = "BDEFGHIJKLMNOPQRSTUVWXYZ"
for c in s:
    if c in big:
        res=False
    
    
if res:
    res="AC"
else :res="WA"
print(res)

Submission status: Accepted

Solution code:
import sys
import os
import numpy as np
import re

S = input()

pattern = re.compile('^A[a-z][a-z]*C[a-z]*[a-z]$')
if pattern.match(S):
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

S = input()
N = len(S)

if S[0] != 'A':
	print('WA')
else:
	S = S.replace('A','a')
	if not 'C' in S[2:N-1]:
		print('WA')
	else:
		S = S.replace('C','c',1)
		for s in S:
			if s in AtoZ:
				print('WA')
				sys.exit()
		print('AC')

Submission status: Accepted

Solution code:
s = raw_input()

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

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



if ans != 1:
	print 'WA'
	quit()

count = 0
for i in range(len(s)):
	if ord('a') <= ord(s[i]) <= ord('z') :
		count += 1

if count != len(s) - 2:
	print "WA"
	quit()

print "AC"

Submission status: Accepted

Solution code:
S = input()

def solve(S):
    if S[0] != "A":
        return False
    s = S[1:]        
    if not "C" in s[1:-1]:
        return False
    i = s[1:-1].find("C") + 1
    s = s[:i] + s[i+1:]
    for c in s:
        if c < "a" or c > "z":
            return False
    return True

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

Submission status: Accepted

Solution code:

def f():
    s = input()
    if s[0] != 'A':
        print('WA')
        return
    found_C = False
    for i in range(1, len(s)):
        if s[i] == 'C':
            if found_C:
                print('WA')
                return
            if i == 1 or i == len(s) - 1:
                print('WA')
                return
            found_C = True
        elif not('a' <= s[i] <= 'z'):
            print('WA')
            return
    if found_C:
        print('AC')
    else:
        print('WA')


f()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S):
    if S[0] != 'A':
        return 'WA'
    if S[2:-1].count('C') != 1:
        return 'WA'

    u = 0
    for c in S:
        if c.isupper():
            u += 1
    if u != 2:
        return 'WA'
    return 'AC'


def main():
    S = read_str().strip()
    print(slv(S))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def count_big(s):
    count = 0
    for s_i in s:
        if s_i in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
            count += 1
    return count

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

Submission status: Accepted

Solution code:
from collections import Counter

S = input()

removeAC = S.replace("A","").replace("C","")

C = Counter(S)

if S[0]=="A" and "C" in S[2:len(S)-1] and C["A"]==1 and C["C"]==1 and removeAC.islower():
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s=input()
f=True
if s[0]=="A":
  if s[2:-1].count("C")==1:
    if "".join(s[1:].split("C")).islower():
      print("AC")
      f=False
if f:
  print("WA")

Submission status: Accepted

Solution code:
S=input().strip()
cond=S[0]=="A" and S[2:-1].count("C")==1
s2=S[1]+S[2:-1].replace("C","")+S[-1]
cond=cond and s2.islower()
print("WA AC".split()[cond])

Submission status: Accepted

Solution code:
S=input()
flag=0
if S[0]=="A":
    flag+=1
if ord(S[1])<97:
    flag=-1
for i in S[2:-1]:
    if i=="C":
        flag+=1
    elif ord(i)<97:
        flag=-1
if ord(S[-1])<97:
    flag=-1
if flag==2:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
from sys import stderr
from functools import reduce
from operator import add
def f(): return [int(i) for i in input().split()]
def yes(n): print("Yes") if n else print("No")    
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(repr(item))
        stderr.write(sep)
    stderr.write(end)

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

Submission status: Accepted

Solution code:
S = input().strip()
cond1 = S[0] == 'A'
cond2 = S[2:-1].count('C') == 1
cond3 = S.replace('A', '').replace('C', '').islower()
if all([cond1, cond2, cond3]):
  print('AC')
else:
  print('WA')

Submission status: Accepted

Solution code:
S = input()

ans = True
if S[0] != 'A':
    ans = False

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

ss = S.replace('A', '*').replace('C', '*') 
if ss.lower() != ss:
    ans = False

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

Submission status: Accepted

Solution code:
S = input()

def func(S):
    for x in S:
        if x in ('A', 'C', 'a', 'c'):
            continue
        if not x.islower():
            return False
    return True

def func2(S):
    cnt = 0
    for x in S[2:-1]:
        if x=='C':
            cnt += 1
    if cnt == 1:
        return True
    return False

if S[0] == 'A' and func2(S) and func(S):
    print("AC")
else:
    print("WA")

Submission status: Accepted

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

c_cnt = 0
for ch in s[2:-1]:
    if ch == "C":
        c_cnt += 1

if c_cnt != 1:
    print("WA")
    exit(0)

s = s[1:]
s = s.replace("C", "")
if s.lower() != s:
    print("WA")
    exit(0)

print("AC")