Problem:


Score : 200 points

Problem Statement

You are given a string S. Each character of S is uppercase or lowercase English letter.
Determine if S satisfies all of the following conditions:

The initial character of S is an uppercase A.

There is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).

All letters except the A and C mentioned above are lowercase.

Constraints

4 ≤ |S| ≤ 10 (|S| is the length of the string S.)

Each character of S is uppercase or lowercase English letter.

Input

Input is given from Standard Input in the following format:

S

Output

If S satisfies all of the conditions in the problem statement, print AC; otherwise, print WA.

Sample Input 1

AtCoder

Sample Output 1

AC

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

Sample Input 2

ACoder

Sample Output 2

WA

The second letter should not be C.

Sample Input 3

AcycliC

Sample Output 3

WA

The last letter should not be C, either.

Sample Input 4

AtCoCo

Sample Output 4

WA

There should not be two or more occurrences of C.

Sample Input 5

Atcoder

Sample Output 5

WA

The number of C should not be zero, either.



Sample input:
AtCoder


Sample output:
AC

Submission status: Accepted

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

S = list(input().rstrip('\n'))
# print(S[2:-1])
if S[0] == 'A' and S[2:-1].count('C') == 1:
    S.remove('A')
    S.remove('C')
    S = ''.join(S)
    # print(S)
    if S.islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
S = input()

if S[0] is 'A' and S[2:-1].count('C') == 1:
    if S[-1] != 'C' and S[:2].count('C') == 0:
        S = S.replace('C', '')
        S = S[1:]
        for i in S:
            if i.islower():
                continue
            else:
                print('WA')
                sys.exit()
        print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
s = input()

if s[0] == 'A' and s[2:-1].count('C') == 1:
    t = s[1:].replace('C', '')
    ans = 'AC' if t.lower() == t else 'WA'
else:
    ans = 'WA'

print(ans)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
if s[0] != 'A':
  print('WA')
  exit()
if 'C' in s[2:-1] and s.count('C') == 1:
  for i in s.replace('A', '').replace('C', ''):
    if 97 <= ord(i) <= 122:
      continue
    else:
      print('WA')
      exit()
  else:
    print('AC')
else:
  print('WA')

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0
inf = float("inf")

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

Submission status: Accepted

Solution code:
s=input()
ans=0
count=0
t=""
if s[0]=="A":
  ans+=1
for i in range(2,len(s)-1):
  # print(s[i])
  if s[i]=="C":
    count+=1
    t=s[1:i]+s[i+1:]	
# print(t)
if t.islower()==True and ans==1 and count==1:
  print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    s = input()
    t = s[:]
    a = [x for x in s.lower()]
    i = s.find('A')
    j = s.find('C')
    if i != -1 and j > 1 and j < len(s) - 1 and s.count('C') == 1:
        a[i] = 'A'
        a[j] = 'C'
        s = ''.join(a)
        if s == t:
            print("AC")
            exit()

    print("WA")


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()




"""

4
1 2
2 4
1 3
3
2 2 4
4 5 6

6
1 2
2 3
3 4
4 5
4 6
3
3 5 6
2 17 31 5 11

"""

Submission status: Accepted

Solution code:
S = input()
if S[0] != 'A':
  print('WA')
elif S[2:-1].count('C') != 1:
  print('WA')
else:
  cindex = S.index('C')
  for i in range(len(S[1:])):
    if i+1 == cindex:
      continue
    if S[i+1].isupper():
      print('WA')
      exit()
  print('AC')

Submission status: Accepted

Solution code:
import re

s = input()
flg = True
if s[0] != "A":
    flg = False
if s[2:-1].count("C") != 1:
    flg = False
if len(re.findall("[A-Z]", s)) != 2:
    flg = False
print("AC" if flg 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')
else:
    i = s.index('C')
    s.pop(i)
    s.pop(0)
    s = ''.join(s)
    if s.islower():
        print('AC')
    else:
        print('WA')

Submission status: Accepted

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

if not ( 4 <= len(S) <= 10 ):
    print('WA')
    sys.exit()
if len(re.findall('[A-Z]',S)) != 2:
    print('WA')
    sys.exit()

result = 0
if array_S[0] != 'A': result += 1
if array_S[2:-1].count('C') != 1: result += 1 
array_S.pop(0)
array_S.pop(array_S.index('C'))
if not "".join(array_S).islower(): result += 1 
print('WA') if result != 0 else print('AC')

Submission status: Accepted

Solution code:
import re
s = input()
pattern = 'A[a-z]+C[a-z]+'

result = re.fullmatch(pattern, s)
# print(result)

if result == None:
    print('WA')
else:
    print('AC')

# if s[0] != 'A':
#     print('WA')
# elif s[1].isupper or s[-1].isupper:
#     print('WA')
# elif s.count('C') != 1:
#     print('WA')
# elif :

Submission status: Accepted

Solution code:
s = input()

if s[0] != "A":
  print("WA")
  exit()
if s[2:-1].count("C") != 1:
  print("WA")
  exit()
t = s.index("C")
if s[1:t].islower() == False or s[t+1:].islower() == False:
  print("WA")
  exit()
print("AC")

Submission status: Accepted

Solution code:
s = input()
length = len(s)
count = 0
count_large = 0
sep = s[2:length-1]


if s[0] == 'A':
    count += 1

if sep.count('C') == 1:
    count += 1

for i in range(length):
    if s[i].isupper():
        count_large += 1
        
if count_large == 2:
    count += 1

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

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = s()

flag = 0
if s[0] == "A":
	flag += 1 
cnt1 = 0
for i in range(2,len(s)-1):
	if s[i] == "C":
		cnt1 += 1
if cnt1 == 1:
	flag += 1
cnt2 = 0
for i in range(1,len(s)):
	if s[i].islower():
		cnt2 += 1
if cnt2 >= len(s) -2:
	flag += 1

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

Submission status: Accepted

Solution code:
s = input()

f = True
if s[0] != 'A':
    f = False
else:
    cnt=0
    for _s in s[2:-1]:
        if _s == 'C':
            cnt+=1
    if cnt!=1:
        f = False
    else:
        cnt = 0
        for _s in s:
            if _s.isupper():
                cnt+=1
        if cnt>2:
            f = False
if f:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
s=input()
ans='AC'
if s[0]!='A':
  ans='WA'
s=s[1:]
if s[1:-1].count('C')!=1:
  ans='WA'
s=s.replace('C','c')
for i in s:
  if i.islower()==False:
    ans='WA'
    break
print(ans)

Submission status: Accepted

Solution code:
S=list(map(lambda x:x,input()))

F=(S[0]=="A")
F&=(S[2:-1].count("C")==1)

if F:
    S.remove("A")
    S.remove("C")
    for s in S:
        F&=(s==s.lower())
if F:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s=input()
ans=0
if s[0]!='A':
    print("WA")
    exit()
for i in range(1,int(len(s))):
    if s[i].isupper():
        if i==1 or i==int(len(s))-1 or s[i]!='C':
            print("WA")
            exit()
        ans+=1
if ans !=1:
    print("WA")
    exit()
print("AC")

Submission status: Accepted

Solution code:
s = input()
ans = 'WA'
if s[0] == 'A' and s[2:len(s)-1].count('C') == 1:
  s = s.replace('A', '').replace('C', '')
  if all([i in [chr(i) for i in range(97, 97+26)] for i in s]):
    ans = 'AC'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ans = "WA"

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

Submission status: Accepted

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

print("WA")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
s = input()

def has_A(x):
    if x[0] == 'A': return True
    return False


def has_C(x):
    if x[2:-1].count('C') == 1: return True
    return False


def is_lower_this_case(x):
    i = x.index('C')
    if x[1:i].islower() and x[i+1:].islower():
        return True
    return False

if has_A(s) and has_C(s) and is_lower_this_case(s):
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
s = input()
flg = 1
if (s[0] != 'A'):
    flg = 0
cnt = 0
for i in s[2:-1]:
    if (i == 'C'): cnt+= 1
if (cnt != 1):
    flg = 0 

cap = 0
for i in s:
    if ('A' <= i <= 'Z'): cap += 1
if (cap != 2):
    flg = 0
if (flg): print("AC")
else: print("WA")

Submission status: Accepted

Solution code:
s = input()
ans = "AC"
if s[0] == "A":
  c_cnt = 0
  for i in range(2,len(s)-1):
    if s[i] == "C":
      c_cnt += 1
  if c_cnt == 1:
    for i in s:
      if i.lower() != "a" and i.lower() != "c" and i.lower() != i:
        ans = "WA"
        break
  else:
    ans = "WA"
else:
  ans = "WA"
print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
a=list(input())

if a[0]!='A' or 'C' not in a[2:-1]:
    print('WA')
    exit()
a.remove('A')
a.remove('C')
n=''.join(a)
if n.islower()==False:
    print('WA')
    exit()
print('AC')

Submission status: Accepted

Solution code:
s = list(input())
ans = "WA"

if s[0] == "A":
    if s[2:-1].count("C") == 1:
        s.remove("C")
        k = "".join(s[1:])
        if k.islower():
            ans = "AC"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
S = input()

def word_check(S):
    for s in S:
        if s.isupper():
            if s not in ["A", "C"]:
                return "WA"
    if S[0] == "A":
        if S[1] not in ["A", "C"] and S[-1] not in ["A", "C"]:
            count_C = 0
            for s in S[2: -1]:
                if s == "C":
                    count_C += 1
            if count_C == 1:
                return "AC"
    return "WA"

print(word_check(S))

Submission status: Accepted

Solution code:
s=list(input())
swi=1
if s[0]=="A":
    if "C" in s[2:-1]:
        s=s[1:]
        s.remove("C")
        swi=0
        for i in range(len(s)):
            if not s[i].islower():
                swi=1
print("AC" if swi==0 else "WA")

Submission status: Accepted

Solution code:
S = input()
if S[0]=="A" and S[2:-1].count("C")==1:
    b = 0
    for s in S:
        if not 97<=ord(s)<=122:
            b += 1
    if b==2:
        print("AC")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

Solution code:
def resolve():
    S = input()
    if S[0] == "A" and S[2:-1].count("C") == 1:
        if S.count("A") == 1 and S.count("C") == 1:
            S = S.replace("A", "").replace("C", "")
            if S == S.lower():
                print("AC")
                return
    print("WA")


resolve()

Submission status: Accepted

Solution code:
s = input()
def WA():
  print('WA')
  exit()
if s[0] != 'A':
  WA()
if ord(s[-1]) < ord('a') or ord('z') < ord(s[-1]):
  WA()
if ord(s[1]) < ord('a') or ord('z') < ord(s[1]):
  WA()
s = s[1:]
ccnt = 0
for i in s[1:-1]:
  if i == 'C':
    ccnt += 1
  elif ord(i) < ord('a') or ord('z') < ord(i):
    print('WA')
    exit()
if ccnt != 1:
  print('WA')
  exit()
else:
  print('AC')

Submission status: Accepted

Solution code:
def actual(s):
    # S の先頭の文字は大文字の A である。
    cond1 = s[0] == 'A'

    # S の先頭から 3 文字目と末尾から 2 文字目の間（両端含む）に大文字の C がちょうど 1 個含まれる。
    cond2 = s[2:-1].count('C') == 1

    # A, C を除く S のすべての文字は小文字である。
    cond3 = all([char.islower() for char in s if char != 'A' and char != 'C'])

    if cond1 and cond2 and cond3:
        return 'AC'

    return 'WA'

s = input()
print(actual(s))

Submission status: Accepted

Solution code:
import sys
s = str(input())

if s[0] != 'A':
    print('WA')
    sys.exit()
    
test_st = s[2:-1]
#print(test_st)
test_stx =''
for i in range(len(test_st)):
    if test_st[i] == 'C':
        test_stx = s[1]+test_st[:i] + test_st[i+1:]+s[-1]
        #print(test_stx)
    
if test_stx.islower() and len(test_stx) >0:
    print('AC')
else:
    print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

print("WA")

Submission status: Accepted

Solution code:
S = input()

if S[0] == "A":
    T = S[2:-1]
    flag = 0
    ok = -1
    for i in T:
        if i == "C" and flag ==0:
            ok = T.index("C")
            flag = 1
        elif i == "C" and flag == 1:
            ok = -1
            break
    if ok >= 0:
        H = S[1:]
        F = H[:ok+1] + H[ok+2:]
        t = False
        for k in F:
            if k.isupper():
                t = True
        if not t:
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

Solution code:
S=input()
p='AC'
o=0
u=0
for i in range(len(S)):
  if i==0 and S[i]!='A':
    p='WA'
    break
  if 2<=i<=len(S)-2:
    if S[i]=='C':
      o+=1
  if len(S)-2<i and o!=1:
    p='WA'
    break
  if ord(S[i])<97:
    if i==0 or 2<=i<=len(S)-2:
      continue
    else:
      p='WA'
      break
print(p)

Submission status: Accepted

Solution code:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    s = input()
    flag = False
    count = 0
    
    for i in range(len(s)):
        if s[i].isupper():
            count += 1

    if count > 2:
        print("WA")
        sys.exit()
    count = 0
    for i in range(len(s)):
        if (i == 0 and s[i] == "A"):
            flag = True
        
        if (2 <= i < len(s)-1):
            if (s[i] == "C"):
                count += 1


    if count != 1:
        flag = False

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
S = list(input())
C_cnt,low,upp = 0,0,0
if S[0] != "A" or S[-1].isupper() or S[1].isupper():
  print("WA")
  sys.exit()
for i in range(2,len(S)-1):
  if S[i] == "C":
    C_cnt += 1
  elif S[i].islower():
    low += 1
  elif S[i].isupper():
    upp += 1
if C_cnt == 1 and low == len(S)-4 and upp == 0:
  print("AC")
else :
  print("WA")

Submission status: Accepted

Solution code:
# B - AcCepted

S = list(str(input()))
ans = 'AC'
if S[0] != 'A':
    ans = 'WA'
else:
    S[0] = 'a'

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

for s in S:
    if s.islower() == False:
        ans = 'WA'
        break

print(ans)

Submission status: Accepted

Solution code:
S=input()
chk = [False, False, False]
if S[0]=="A":
    chk[0]=True

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

chk[2]=True
for i in range(len(S)):
    if i==ind or i==0:
        continue
    if S[i].isupper():
        chk[2]=False

if chk[0] and chk[1] and chk[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[1:].replace("C","c").islower():
    print("AC")
    exit()

print("WA")

Submission status: Accepted

Solution code:
s = input()

flg = 0

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

t  = s[2:-1]


if t.count("C") == 1:
    flg = 1
else:
    print("WA")
    exit()

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


if s.islower():
    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:].replace("C", "c").islower():
            print("AC")
            exit()

print("WA")

Submission status: Accepted

Solution code:
s = input()
n = len(s)
ok = True
if s[0] != 'A': ok = False
c_counter = 0
p = -1
for i in range(2,n-1):
    if s[i] == 'C':
        c_counter += 1
        p = i
if c_counter != 1: ok = False
if ok == 0: 
    print('WA')
    exit()
for i in range(n):
    if i == 0 or i == p: continue
    if ord(s[i]) < 97: ok = False
if ok: print('AC')
else: print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
a = s.lower()
l = len(s)
c = 0
n = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
num_C = 0

for i in range(len(s)):
    if i == 0:
        if s[i] != 'A':
            print('WA')
            exit() 
    elif i >= 2 and i <= len(s)-2:
        if s[i] == 'C': num_C += 1
    else:
        if ord(s[i]) < ord('a') or ord(s[i]) > ord('z'):
            print('WA')
            exit()
if num_C != 1:
    print('WA')
    exit()
print('AC')

Submission status: Accepted

Solution code:
S = input()
cond1 = (S[0]=="A")
cond2 = (S[2:len(S)-1].count("C") == 1)


flag = True
if not cond1:
    flag = False
else:
    if not cond2:
        flag = False
    else:
        idx = S[2: len(S)-1].index("C") + 2
        new = S[1:idx] + S[idx+1:]
        if new != new.lower():
            flag = False

if flag:
    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[1:s.find('C')]+s[s.find('C')+1:]).islower():
    print('AC')
else:
    print('WA')

Submission status: Accepted

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

# In[20]:


S = input()


# In[21]:


mylist = [x for x in S]
if mylist[0] != "A":
    print("WA")
elif mylist[2:-1].count("C") != 1:
    print("WA")
else:
    C_idx = mylist[2:-1].index("C") + 2
    mylist.pop(C_idx)
    if str("".join(mylist[1:])).islower():
        print("AC")
    else:
        print("WA")


# In[ ]:

Submission status: Accepted

Solution code:
def resolve():
    S = str(input())
    if S[0] != 'A':
        print('WA')
        return

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

    if S.replace('A', 'a').replace('C', 'c') != S.lower():
        print('WA')
        return

    print('AC')

    return
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    flag = True
    cnt = 0
    for i in range(len(S)):
        if i == 0:
            if S[i] != 'A':
                print("WA")
                return
        else:
            if 2 <= i <= len(S)-2 and S[i] == 'C':
                cnt += 1
            elif S[i].isupper():
                print("WA")
                return
    if cnt == 1:
        print("AC")
    else:
        print("WA")
            
main()

Submission status: Accepted

Solution code:
S=input()
MojiNagasa=len(S)
flag=True
if S[0]!="A":
  flag=False
count=0
for i in range(1,MojiNagasa):
  if S[i].isupper():
    if i==1 or i==MojiNagasa-1 or S[i]!='C':
      flag=False
    count+=1
if (count!=1):
  flag=False
print("AC" if flag else "WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
ans="WA"
if s[0]=="A":
    if s[2:-1].count("C")==1:
        s=list(s)
        s.remove("A")
        s.remove("C")
        for j in range(len(s)):
            if ord(s[j])<ord("a"):
                break
        else:
            ans="AC"
print(ans)

Submission status: Accepted

Solution code:
S = input()
n = len(S)
up = 0
flag = False

for i, s in enumerate(S):
    if (i == 0) & (s != 'A'):
        break
    if s.isupper():
        up += 1
    if (1 < i) & (i < n-1):
        if s == 'C':
            flag = True

if flag & (up == 2):
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
s=input()
n=len(s)
if n==4:
    x=s[2]
else:
    x=s[2:n-1]
    
if s[0]!='A':
    print('WA')
    
elif x.count('C')!=1:
    print('WA')
    
else:
    i=x.find('C')
    s=list(s)
    s.pop(i+2)
    s.pop(0)
    s=''.join(s)
    if s.islower()==True:
        print('AC')
    else:
        print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)

f = False
ans = s[0] == 'A'
for i in range(1,n):
    if 'a' <= s[i] <= 'z': continue

    if not f and i>1 and i<n-1 and s[i] == 'C':
        f = True
        continue

    ans = False
    break

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

Submission status: Accepted

Solution code:
import sys
s = input()
ans = 'AC'
c = 0
if s[0] != 'A':
    ans = "WA"
for i in range(2,len(s)-1):
    if "C" == s[i]:
        c += 1
if c != 1:
    ans = "WA"
c = 0
for i in range(len(s)):
    a = ord(s[i])
    if 65 <= a and a <= 96:
        c += 1
if c != 2:
    ans = "WA"
print(ans)

Submission status: Accepted

Solution code:
# coding = SJIS
s = str(input())
lar = "BDEFGHIJKLMNOPQRSTUVWXYZ"
if s[0] != "A":
    print("WA")
    exit()
elif s[2:len(s)-1].count("C") != 1:
    print("WA")
    exit()
elif s[0:2].count("C") + s[-1].count("C") > 0:
    print("WA")
    exit()
kaz = 0
for i in lar:
    kaz += s.count(i)
if kaz > 0:
    print("WA")
    exit()
print("AC")

Submission status: Accepted

Solution code:
import re

s = input()

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

Submission status: Accepted

Solution code:
s = input()
cnt = 0

if s[0] == 'A':
    for i in s[2:-1]:
        if i == 'C':
            cnt += 1
    if cnt == 1:
        s = s.replace('A', '')
        s = s.replace('C', '')
        if s.islower() and ('C' not in s):
            print('AC')
            exit()
print('WA')

Submission status: Accepted

Solution code:
strs=input()
che=True
c=True
coun=False
for i in range(0,len(strs)) :
    if(i==0):
        c=True if strs[i]=="A" else False
    else :
        if(strs[i].isupper()):
            if( (not coun) and i>=2 and i<=len(strs)-2 and strs[i]=='C'):
                coun=True
            else:
                che=False
print("AC") if che and coun and c else print("WA")

Submission status: Accepted

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


def main():
    S = input()
    if S[0] != 'A' or ord('A') <= ord(S[1]) <= ord('Z') or ord('A') <= ord(S[-1]) <= ord('Z'):
        print("WA")
        return
    capital = []
    for i in range(2, len(S) - 1):
        if ord('a') <= ord(S[i]) <= ord('z'): continue
        capital.append(S[i])
    
    if capital == ['C']:
        print("AC")
    else:
        print("WA") 


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def resolve():
    S = input()
    abc = "abcdefghijklmnopqrstuvwxyz"
    count = 0
    if S[0]=="A":
        S = S[1:]
        if "C" in S[1:-1] and S.count("C")==1:
            S = S[:S.index("C")] + S[S.index("C")+1:]
            for i in range(len(S)):
                if S[i] in abc:
                    count += 1
            if count == len(S):
                print("AC")
            else:
                print("WA")
        else:
            print("WA")
    else:
        print("WA")
resolve()

Submission status: Accepted

Solution code:
import math
from collections import deque
from collections import defaultdict

import itertools as it

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	#data = [2]
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	#ans = [x for x in data if x!=0]
	ans = data[:]
	return ans

s = input()

f1 = s[0]=="A"

f2 = s[2:-1].count("C")==1

t=""
for i in s:
	if i!="A" and i!="C":
		t+=i

f3 = t == t.lower()

if f1*f2*f3:
	print("AC")
else:
	print("WA")

Submission status: Accepted

Solution code:
s = str(input())

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

Submission status: Accepted

Solution code:
s = str(input())

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

Submission status: Accepted

Solution code:
def mi():
    return map(int, input().split())

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

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

    if S[0].replace('A', 'a')+S[1]+S[2:-1].replace('C', 'c')+S[-1:] != S.lower():
        print('WA')
        return

    print('AC')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=input()
AC="AC"
if not s[0]=="A":
  AC="WA"
s=s[1:]  
if not s[1:-1].count("C")==1:
  AC="WA"
s=s.replace("C","c")


if not s.islower():
  AC="WA"
  
print(AC)