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 bisect,collections,copy,heapq,itertools,math,operator,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
S = S()
condition1 = S[0]=='A'
condition2 = S[2:-1].count('C')==1
S = S.replace('A','a',1)
S = S.replace('C','c',1)
condition3 = S.islower()
print('AC' if condition1 and condition2 and condition3 else 'WA')

Submission status: Accepted

Solution code:
S = input()

if S[0] != 'A':
    print('WA')
    exit()
    
index = S[2:-1].find('C')
if index == -1:
    print('WA')
    exit()
index = S[2:-1].find('C',index+1)
if index >= 0:
    print('WA')
    exit()


index = S.find('C')
S=S[1:index] + S[index + 1:len(S)]

if S != S.lower():
    print('WA')
    exit()

print('AC')

Submission status: Accepted

Solution code:
icase=104
if icase==104:
    s=input()
    yn=""
    if s[0]!="A":
        yn="WA"
    elif not s[1].islower():
        yn="WA"
    else:
        icnt=0
        for i in range(2,len(s)-1):
            if s[i]=="C":
                icnt+=1
            elif not s[i].islower():
                yn="WA"
                break
        if icnt!=1:
            yn="WA"                
        if not s[-1].islower():
            yn="WA"
    if yn=="WA":
        print("WA")
    else:
        print("AC")

Submission status: Accepted

Solution code:
# abc104_b.py
S = input()
upper_cnt=0
for i,c in enumerate(S):
    if (i==0 and c!="A") or S[2:-1].count("C")!=1 or (i==1 and not c.islower()):
        print('WA')
        exit()
    if i>=1 and c.isupper():
         upper_cnt+=1
    if upper_cnt >1:
        print('WA')
        exit()
print('AC')

Submission status: Accepted

Solution code:
s = input()
flag = True
ko = ["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 s[0] == 'A':
    pass
else:
    flag = False
cnt = 0
for i in range(2, len(s)-1):
    if s[i] == 'C':
        cnt += 1
        id = i
if cnt == 1:
    pass
else:
    flag = False
if flag:
    for i in range(1, len(s)):
        if id != i:
            if s[i] not in ko:
                flag = False
if flag:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()
t = s[2:-1]
i = s.find('C')
u = s[1:i] + s[i+1:]
if s[0]!='A' or 'C' not in t or t.count('C')!=1 or not u.islower():
    print('WA')
else:
    print('AC')

Submission status: Accepted

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

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


if 'C'not in S[2:-1]:ans='WA'

count=0
for i in S:
    if 65<=ord(i)<=90:
        count+=1
if count!=2:ans='WA'

print(ans)

Submission status: Accepted

Solution code:
# solution
import io

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

Submission status: Accepted

Solution code:
def main():
    S = list(input())
    res = True
    if S[0] != "A" :
       res = False 
    count = S[2:len(S)-1].count("C")
    if count > 1 or count == 0:
        res = False
    else:
        S.remove("C")
    S.pop(0)
    for i in range(len(S)):
        if str(S[i]).isupper() :
            res = False
    if res :
        print("AC")
    else:
        print("WA")
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
if (S[0]=='A' and S[2:-1].count('C')==1):
    pos=S.index("C")
    check=S[1:pos]+S[pos+1:]
    if check.islower():
        print('AC')
    else:
        print('WA')
else:
    print('WA')

Submission status: Accepted

Solution code:
s = input()
ans = 1
if s[0] != 'A':
    ans = 0
if not 'C' in s[2:-1]:
    ans = 0
cnt = 0
for i in s:
    if i in [chr(i) for i in range(65, 65+26)]:
        cnt += 1
if cnt != 2:
    ans = 0
if ans == 1:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
S = input()
flag = 1
if S[0] != 'A':
    flag = 0
if not 'C' in S[2:-1]:
    flag = 0
cnt = 0
for i in S:
    if i in [chr(i) for i in range(65, 65+26)]:
        cnt += 1
if cnt != 2:
    flag = 0
if flag:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
S = input()
flag = True
if S[0] != 'A':
    flag = False
if S.count('C') != 1 or 'C' not in S[2:-1]:
    flag = False
if S.replace('A', 'a').replace('C', 'c').islower() != True:
    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):
  pos=s.index("C")
  check=s[1:pos]+s[pos+1::]
  if (check.islower()):
    print("AC")
  else:
    print("WA")
else:
  print("WA")

Submission status: Accepted

Solution code:
from string import ascii_lowercase

s = list(input())
ans = 'AC'

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

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

if not s[1] in ascii_lowercase:
    ans = 'WA'

if not s[-1] in ascii_lowercase:
    ans = 'WA'

for c in s[2:-1]:
    if c == 'C':
        continue
    if not c in ascii_lowercase:
        ans = 'WA'
        
print(ans)

Submission status: Accepted

Solution code:

def myAnswer(S:list)->str:
   if(S.pop(0) !="A"): return "WA"
   flag = False
   for n,s in enumerate(S):
      if(n>=1 and n <= len(S)-2 and flag==False and s=="C"):
         flag = True
      else:
         if(s.isupper()):
            return "WA"
   return "WA" if(flag==False) else "AC"


def modelAnswer():
   tmp=1
def main():
   S = list(input())
   print(myAnswer(S))
if __name__ == '__main__':
   main()

Submission status: Accepted

Solution code:
S = str(input())
alp = "ABDEFGHIJKLMNOPQRSTUVWXYZ"
if S[0] == 'A' and S.count('C') == 1 and S[2:-1].count('C') == 1:
  for i in range(1,len(S)):
    if S[i] in alp:
      print("WA")
      exit()
  print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
s = input()
if s.count('C')==1:
    a=s.index('C')
else:
    a=0
print('AC' if s[0]=='A' and s.count('C')==1 and s[1:a]+s[a+1:]==(s[1:a]+s[a+1:]).lower() and 1<a<len(s)-1 else 'WA')

Submission status: Accepted

Solution code:
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

s = ns()

if s[0] == 'A' and s[2:-1].count('C') == 1:
    indx = 2 + s[2:-1].index('C')
    for i in range(len(s)):
        if i != 0 and i != indx and s[i] != s[i].lower():
            break
    else:
        print('AC')
        exit()

print('WA')

Submission status: Accepted

Solution code:
# ABC 104: B – AcCepted
s = input()
alphabets = 'abcdefghijklmnopqrstuvwxyz'

isMeet = 'AC'

if s[0] == 'A':
    if s[2:-1].count('C') == 1:
        t = s[1:].replace('C', '')
        for c in t:
            if c not in alphabets:
                isMeet = 'WA'
                break
    else:
        isMeet = 'WA'
else:
    isMeet = 'WA'

print(isMeet)

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
S = input()

success = False
if S[0] == 'A':
    if 'C' in S[2:-1]:
        ix = S.index('C')
        for i in range(1, len(S)):
            if i != ix:
                if S[i].islower():
                    pass
                else:
                    break
        else:
            success = True
if success:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
S = list(input())

flag = True

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

Submission status: Accepted

Solution code:
s = input()

ans = True if s[0] == 'A' else False
num = 0
for i in range(1, len(s)):
    if s[i] == 'C' and i != len(s) - 1 and i != 1:
        num += 1
    elif ord(s[i]) <= ord('Z') and ord(s[i]) >= ord('A'):
        ans = False
        break

if num != 1:
    ans = False

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

Submission status: Accepted

Solution code:
S = input()
L = [chr(i) for i in range(97, 97+26)]
if S[0] == "A":
  c = 0
  for i in range(2,len(S)-1):
    if S[i] == "C":
      c +=1
      k = i
  if c == 1:
    T = "AC"
    for j in range(1,len(S)):
      if j != k:
        if not S[j] in L:
          T = "WA"
          break
    print(T)
  else:
      print("WA")
else:
  print("WA")

Submission status: Accepted

Solution code:
s = list(input())
l = s[2:-1]
if s[0] == "A" and "C" in l:
    s.remove("A")
    s.remove("C")
    if str(s).islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = list(input())
c = 0
flag = 0
if S[0] == "A":
    for i in range(len(S)-3):
        if S[2+i] == "C":
            c += 1
            this = 2+i
    if c == 1:
        S.pop(this)
        S.pop(0)

    for i in S:
        if ord(i) < 97:
            flag = 0
            break
        else:
            flag = 1

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

Submission status: Accepted

Solution code:
s = list(input())

if s[0] == "A" and s[2:-1].count("C") == 1:
  s.remove("A")
  s.remove("C")
  for c in s:
    if c.isupper() == True:
      print("WA")
      exit()
    else:
      continue
  print("AC")

else:
  print("WA")

Submission status: Accepted

Solution code:
s = list(input())
if s[0] != "A" or s.count("A") != 1 or s.count("C") != 1 or s[2:-1].count("C") != 1:
    print("WA")
    exit()
s.sort()
for i in range(2, len(s)):
    if s[i].isupper():
        print("WA")
        exit()
print("AC")

Submission status: Accepted

Solution code:
S = input()

ans = True

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

if not ('a' <= S[1] and S[1] <= 'z'):
    ans = False

cnt = 0
for s in S[2:-1]:
    if s == 'C':
        cnt += 1
    else:
        if not ('a' <= s and s <= 'z'):
            ans = False

if cnt != 1:
    ans = False

if not ('a' <= S[-1] and S[-1] <= 'z'):
    ans = False

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
alp = [chr(ord('a')+i)for i in range(26)]
a = s[0] == 'A'
b = s.count('C') == 1 and s.index('C') >=2 and s.index('C')<= n-2
c = True
for i in range(n):
    if i == 0:continue
    if s[i] == 'C':continue
    if s[i] not in alp:
        c = False
ok = a and b and c
if ok:print('AC')
else:print('WA')

Submission status: Accepted

Solution code:
s = input()

alphabet = 'abcdefghijklmnopqrstuvwxy'

ans = 'AC'

C_count = s.count('C')
if C_count == 1 and s[0] == 'A' and s[1] != 'C' and s[-1] != 'C':
    s = s.replace('C', 'c')

    for i in range(1, len(s)):
        if s[i] in alphabet:
            pass
        else:
            ans = 'WA'
            break
else:
    ans = 'WA'

print(ans)

Submission status: Accepted

Solution code:
def check(s):
  if s[0]!="A":
    return 0
  c = 0
  for i in range(1,len(s)):
    if s[1].isupper() or s[-1].isupper():
      return 0
    if s[i].isupper():
      if c!=0:
        return 0
      if s[i]=="C":
        c=1
      else:
        return 0
  if c==0:
    return 0
  return 1    

s = list(input())
if check(s):
  print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
import sys
S = input()
cnt = 1
tmp = 0
if S[0] == 'A':
    for i in range(2, len(S)-1):
        if S[i] == 'C':
            tmp = i
            cnt -= 1
if cnt == 0:
    for i in range(len(S)):
        if S[i].isupper() is True and i != 0 and i != tmp:
            print('WA')
            sys.exit()
    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:
    l = list(s[1::])
    l.remove('C')
    st = ''.join(l)
    if st == st.lower():
        print('AC')
    else:
        print('WA')

Submission status: Accepted

Solution code:
S = input()
F = True
if S[0] != "A":
  F =False
if not("C" in S[2:-1]):
  F = False
if S[1:].count("C")==1:
  for i in range(1,len(S)):
    if S[i] != "C" and S[i].isupper():
      F = False
elif S[1:].count("C")>1:
  F = False
print("AC" if F else "WA")

Submission status: Accepted

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

else:
    print("WA")

Submission status: Accepted

Solution code:
s=input()
if s[0]!="A" or ("C" not in s[2:-1]) or s.count("C")!=1 or s[1:].replace("C","").lower()!=s[1:].replace("C",""):
    print("WA")
else:print("AC")

Submission status: Accepted

Solution code:
a = input()
def atcoder(p):
    count = 0
    if p[0]=='A':
        count += 1
    
    count_C=0
    for i in range(len(p)-2):
        if p[i+2]=='C':
            count_C += 1
    if count_C == 1:
        count += 1
    
    count_c = 0
    for i in range(len(p)-1):
        if p[i].upper() ==p[i]:
            count_c+=1
    if p[len(p)-1]==p[len(p)-1].upper():
        count_c+=2
    if len(p)==3:
        count_c+=2
    if count_c ==2:
        count += 1
    
    
    if count ==3:
        print('AC')
    else:
        print('WA')
         
atcoder(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
ans="WA"
if S[0]=="A" and "C" in S[2:len(S)-1]:
    A=list(S[1:])
    A.remove("C")
    A=str(A)
    if A.islower()==True:
        ans="AC"
print(ans)

Submission status: Accepted

Solution code:
s = input()
n = len(s)
Ccnt = 0
def end():
  print('WA')
  exit(0)
  return 
for i in range(n):
  if i == 0:
    if s[i] != 'A':end()
  else:
    if s[i].isupper():
      if 2<=i<n-1 and s[i] == 'C':Ccnt += 1
      else:end()
if Ccnt != 1:end()
print('AC')

Submission status: Accepted

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

if s[0]=="A" and "C" in s[2:n-1]:
    check=s[1:]
    check.remove("C")
    s="".join(check)
    if s==s.lower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


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

    okflag = 0
    okflag1 = 0
    okflag2 = 0

    if S[0] == 'A':
        okflag1 = 1
    if S[1].islower() and S[len(S)-1].islower():
        okflag2 = 1
    for i in range(2, len(S)-1):
        if S[i] == "C" and okflag == 0:
            okflag = 1
        elif S[i].islower():
            pass
        else:
            okflag = 0
            break

    if okflag == 1 and okflag1 == 1 and okflag2 == 1:
        print("AC")
    else:
        print("WA")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
if __name__ == '__main__':

	s = input()
	flg = False
	
	if s[0] == "A":
		tmp = s[2:-1]
		if tmp.count("C") == 1:
			tmp2 = s.replace("A","")
			tmp2 = tmp2.replace("C","")
			if tmp2.islower() == True:
				flg = True

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

Submission status: Accepted

Solution code:
import re
S = input()
result = re.match('^A[a-z]{1}[a-z]{0,6}C[a-z]{1,7}$', S)

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

Submission status: Accepted

Solution code:
import re
S = input()

match = re.search(r'A[a-z][a-z]*C[a-z]*[a-z]', S)
if match == None:
    print("WA")
    exit()
if match.group() == S:
    print("AC")
else:
    print("WA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())
S = [s[i] for i in range(len(s))]
fr = 0
count = 0
if S[0] == 'A':
    S.pop(0)
else:
    fr = 1
for i in range(1,(len(S)-1)):
    if S[i] == 'C' and count == 0:
        S.pop(i)
        count += 1
s = ''.join(S)
if s.islower() and count == 1 and fr == 0:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
S = input()

flag = True
c_count = 0
for i in range(0, len(S)):
  if i == 0:
    if S[i] != "A":
      flag = False
      break
  elif i >= 2 and i <= (len(S) - 2):
    if S[i] == "C":
      c_count += 1

  if ord("A") <= ord(S[i]) and ord(S[i]) <= ord("Z"):
    if ord("A") != ord(S[i]) and ord("C") != ord(S[i]):
      flag = False
      break

if flag and c_count == 1:
  print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
s_list = list(input())
n = len(s_list)
c_count = 0
if s_list[0] == "A":
    for s in s_list[2:-1]:
        if s == "C":
            c_count += 1
    if c_count == 1:
        if all([(s_list[i] == "C" and 2 <= i <= n - 2) or s_list[i].islower() for i in range(1, n)]):
            print("AC")
            exit()
print("WA")

Submission status: Accepted

Solution code:
s = input()
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:
S = list(input())
ans = "WA"

if S[0] == "A":
    C_num = 0
    for char in S[2:-1]:
        if char == "C":
            C_num += 1
    if C_num == 1:
        check_S = S[1:]
        C_index = check_S.index("C")
        del check_S[C_index]
        frag = True
        for char in check_S:
            if char.isupper():
                frag = False
                break
        if frag == True:
            ans = "AC"

print(ans)

Submission status: Accepted

Solution code:
import re

S = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
if S[0] == 'A':
    if S[2:-1].count('C') == 1:
        for s in S[1:]:
            if s != 'C':
                if s != s.lower():
                    break
        else:
            print('AC')
            exit()
print('WA')

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = iss()
    if S[0] == 'A' and S[2:-1].count('C') == 1:
        for s in list(S):
            if s != 'A' and s != 'C' and str.isupper(s):
                print('WA')
                exit()
        else:
            print('AC')
    else:
        print('WA')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

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

if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
word = input()
import re
dst = ""
if word[0] == "A":
    if len(re.findall("C", word[2:-1])) == 1:
        if len(re.findall(r"[a-z]", word)) == len(word) - 2:
            dst = "AC"
if not dst:
    dst = "WA"
print(dst)

Submission status: Accepted

Solution code:
S=input()

if S[0]!="A":
  print("WA")
else:
  cnt_C=0
  for i in range(2,len(S)-1):
    if S[i]=="C":
      cnt_C+=1
      
  if cnt_C!=1:
    print("WA")
  else:
    cnt_upper=0
    for i in range(len(S)):
      if S[i].isupper():
        cnt_upper+=1
        
    if cnt_upper!=2:
      print("WA")
    else:
      print("AC")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    s = input()
    count =0

    for i in range(len(s)):
        if s[0] != "A":
            count += 2
        if s[i] =="C" :
            if i < len(s)-1 and i >1:
                count +=1
            else:
                count+=2
        elif i>0 and ( ord(s[i]) <97 or ord(s[i]) >122):
            count += 2

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

Submission status: Accepted

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  s = input()
  if s[0] == 'A':
    Cs = s[2:len(s)-1]
    #print(Cs)
    if Cs.count('C') == 1:
      s = s.replace('A',"").replace('C',"")
      for i in range(len(s)):
        #print(s)
        if 'a' <= s[i] <= 'z':
          pass
        else:
          print('WA')
          exit()
      print('AC')
    else:
      print('WA')
    
    
  else:
    print('WA')
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
s = list(input())

bl = False
s1 = s[1]
s2 = s[2:len(s)-1]
s3 = s[-1]

if s[0] == 'A' and s[2:len(s)-1].count('C') == 1:
    s2.remove('C')
    s2 = ''.join(s2)
    ss = s1+s2+s3
    if ss.islower():
        bl = True

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

Submission status: Accepted

Solution code:
S = str(input())
s = list(S)
u = s
p = 0
for i in range(2,len(s)-1):
        if s[i] == 'C':
            p = p + 1
for i in range(2,len(s)-p):
    if s[i] == 'C':
        if i != len(s) - 1:
            del s[i]
if s[0] == 'A':
    del s[0]
    if p == 1:
        q = ''.join(s)
        if q.islower() == True:
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')

Submission status: Accepted

Solution code:
from collections import Counter
l=input()
s=list(l)
k=0
if s[0]=='A':
    for i in range(2,len(s)-1):
        if s[i]=='C':
            k+=1
    if k==1:
        if l.replace('A', 'a').replace('C', 'c') == l.lower():print('AC')
        else:print('WA')
    else:print('WA')
else:print('WA')

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

alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
s = input()
n = len(s)
if s[0] != 'A':
    print('WA')
    quit()
cnt = 0
for i in range(2,n-1):
    if s[i] == 'C':
        cnt += 1
    elif s[i] in alpha:
        print('WA')
        quit()
if cnt != 1:
    print('WA')
    quit()
if s[1] in alpha:
    print('WA')
    quit()
if s[-1] in alpha:
    print('WA')
    quit()
print('AC')

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def solve():
    s = list(input())
    if s[0] == "A" and s[2:-1].count("C") == 1:
        s.remove("A")
        s.remove("C")

        if "".join(s).islower():
            print("AC")
            exit()

    print("WA")


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:

def AcCepted(s):

    ans = "WA"

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

    return ans

def main():
    s = str(input())
    print(AcCepted(s))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
list_S = list(input())
ans = "WA"
if list_S[0] == "A":
    list_S.remove("A")
    if "C" in list_S[1:-1]:
        list_S.remove("C")
        for c in list_S:
            if c not in ["q","a","z","w","s","x","e","d","c","r","f","v","t","g","b","y","h","n","u","j","m","i","k","o","l","p"]:
                ans = "WA"
                break
            else:
                ans = "AC"

print(ans)

Submission status: Accepted

Solution code:


def solve():
    s = list(input())
    if (s[0] == "A") and (s[2:-1].count("C") == 1):
        s.remove("A")
        s.remove('C')
        if str(s).islower():
            print("AC")
        else:
            print('WA')
    else:
        print('WA')


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
s = input()
ans = 1

if s[0] == "A":
    ans += 1
    
part = s[2:-1]
if part.count("C") == 1:
    ans += 1
      
for i in range(len(s)):
    if 65 < ord(s[i]) <91 and ord(s[i]) != 67:
        ans -= 1
        
print("AWCA"[ans<3::2])

Submission status: Accepted

Solution code:
s = str(input())
n = len(s)
if s[0] == "A":
    cntC = 0
    for i in s[2: n - 1]:
        if i == "C":
            cntC += 1
    if cntC == 1:
        cnt = 0
        for j in s:
            if j.isupper():
                cnt += 1
        if cnt == 2:
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")