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, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

s = input()
chk_C = False
if s[0] != "A":
    print("WA")
    exit()
else:
    for i in range(len(s)):
        if i == 0:
            pass
        else:
            if s[i] == "C" and chk_C == False and i >= 2 and i <= len(s)-2:
                chk_C = True
                pass
            elif s[i] == s[i].lower():
                pass
            else:
                print("WA")
                exit()
    if chk_C == True:
        print("AC")
    else:
        print("WA")

Submission status: Accepted

Solution code:
#n=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
s=list(input())
chk=list("abcdefghijklmnopqrstuvwxyz")
flag="WA"
n=len(s)

if s[0]=="A":
    temp=s[2:n-1]
    if temp.count("C")==1:
        ind=temp.index("C")
        ind+=2
        del s[0]
        del s[ind-1]
        for st in s :
            if st in chk:
                pass
            else:
                flag="WA"
                break
            flag="AC"
print(flag)

Submission status: Accepted

Solution code:
S = list(input())
if S[0] != 'A':
    print('WA')
    exit()
S[0] = 'a'
if S.count('C') != 1:
    print('WA')
    exit()
i = S.index('C')
if i == 1 or i == len(S)-1:
    print('WA')
    exit()
S[S.index('C')] = 'c'
if ''.join(S) == ''.join(S).lower():
    print('AC')
else:
    print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
n = len(s)
if s[0] == "A" and s[2:n-1].count("C") == 1 and len(set(s.upper()) & set(s)) == 2:
  print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
s = input()
n = len(s)
if s[0] == "A" and s[2:n-1].count("C") == 1 and len(set(s.upper()) & set(s)) == 2:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()
if s[0] == 'A' and s.count('A') == 1 and s.count('C') == 1 and s[2:-1].count('C') == 1:
    s = s.replace('A', '').replace('C', '')
    for c in s:
        if ord(c) < ord('a'):
            print('WA')
            exit(0)
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
import re
s = input()

s1 = re.fullmatch(r"A([a-z]+)C([a-z]+)", s)

if s1 == None:
    print("WA")
else:
    print("AC")

Submission status: Accepted

Solution code:
s = input()

j1 = s[0] == 'A'
j2 = s[2:-1].count('C') == 1
j3 = True

s3 = set(s) - set('AC')
for i in s3:
    if i != i.lower():
        j3 = False
        break

print('AC') if j1 and j2 and j3 else print('WA')

Submission status: Accepted

Solution code:
S = input()
abc = 'abcdefghijklmnopqrstuvwxyz'
if S[0] == 'A':
  if S[2:len(S)-1].count('C') == 1:
    for c in S:
      if (c!='A') and (c!='C') and (c not in abc):
        print('WA')
        exit()
    else:
      print('AC')
  else:
    print('WA')
else:
  print('WA')

Submission status: Accepted

Solution code:
s = input()

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

if not list(s[2:-1]).count("C") == 1:
    print ("WA")
    exit ()

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

if s.islower():
    print ("AC")
else:
    print ("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
s = input()
p = re.compile('[a-z]+')
ans = ''
if s[0] == 'A' and s[2:-1].count('C') == 1:
  s = s.replace('A', '').replace('C', '')
  if p.fullmatch(s):
    ans = 'AC'
  else:
    ans = 'WA'
else:
  ans = 'WA'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
if S[0] == 'A' and S[2:-1].count('C') == 1:
    chk = S.replace('A', '').replace('C', '')
    l = len(chk)
    cnt = 0
    for s in chk:
        if s.islower():
            cnt += 1
    if cnt == l:
        print('AC')
        exit()
print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

if S[0] == 'A' and S[2:-1].count('C') == 1: 
    s = S.replace('A', 'a').replace('C', 'c')
    t = s.lower()
    if s == t:
        print('AC')
        exit()
print('WA')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
charset = set(list(S))
if 'A' in charset:
    charset.remove('A')
if 'C' in charset:
    charset.remove('C')
# print(f'S:{S} charset:{charset}', file=sys.stderr)
if S[0] == 'A' and S[2:-1].count('C') == 1 and ''.join(charset).islower():
    print('AC')
else:
    print('WA')

Submission status: Accepted

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

count = 0
if S[0] != "A" or not S[1].islower() or not S[-1].islower():
    print("WA")
else:
    count = 0
    for i in range(2, n-1):
        c = S[i]
        if c == "C":
            if count == 1:
                print("WA")
                break
            else:
                count = 1
        elif not c.islower():
            print("WA")
            break
    else:
        if count == 1:
            print("AC")
        else:
            print("WA")

Submission status: Accepted

Solution code:
s=list(input())
s1=s[2:-1]
f=True
if s[0]!='A':
	f=False
elif 'C' not in s1:
	f=False
else:
	s.remove('A')
	s.remove('C')
	if str(s).islower():
		pass
	else:
		f=False
if f:
	print('AC')
else:
	print('WA')

Submission status: Accepted

Solution code:
S = input()
flag = 1
if S[0] != "A":
	flag = 0
elif S[2:-1].count("C") != 1:
	flag = 0
else:
	idx = S[2:-1].find("C")
	S2 = S[1:idx+2]+ S[idx + 3:]
	if not S2.islower():
		flag = 0

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

Submission status: Accepted

Solution code:
import sys
S = input()
if S[0] != "A":
  print("WA")
  sys.exit()

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

Cindex = S.find("C")
if Cindex < 2 or Cindex > len(S)-2:
  print("WA")
  sys.exit()
  
T = 'a' + S[1:]
T = T[0:Cindex] + "c" + T[Cindex+1:]

if T.islower():
  print("AC")
else:
  print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
if s[0] == "A" and "C" in s[2:-1] and s[1:].replace("C","",1).islower():
    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].islower() and S[-1].islower():
    for s in S[2:]:
        if s!="C":
            if s.islower():
                print("AC")
                exit()
print("WA")

Submission status: Accepted

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

S = input()

cond1 = S[0] == 'A'
cond2 = S[2:-1].count('C') == 1
cond3 = True
for i, s in enu(S):
    if i==0:
        continue
    if 2<=i<=len(S)-2 and s=='C':
        continue
    if s == s.upper():
        cond3 = False

if cond1 and cond2 and cond3:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
s = input()
ac = True
c = True
if s[0] != "A":
  ac = False
if not ord("a") <= ord(s[1]) <= ord("z"):
  ac = False
if not ord("a") <= ord(s[-1]) <= ord("z"):
  ac = False
for i in range(2, len(s)-1):
  if s[i] == "C":
    if c:
      c = False
    else:
      ac = False
  else:
    if not ord("a") <= ord(s[i]) <= ord("z"):
      ac = False
if c:
  ac = False
if ac:
  print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
S = input()

if S[0] == "A" and S.count("A") == 1 and S.count("C") == 1:
    p = S.find("C")
    b = S.replace("A","").replace("C","")
    if p > 1 and p < len(S) - 1 and b.islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = input()
count=0
if S[0]=="A":
  for i in range(2,max([len(S)-1,3]),1):
    if S[i]=="C":
      count+=1
      idx=i
  if count==1:
    s=S[1:idx]+S[idx+1:]
    if s==s.lower():
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")

Submission status: Accepted

Solution code:
S = str(input())

if S[0] == "A":
    next = S[2:-1]

    if next.count("C") == 1:
        next = list(S[1:])
        next.remove("C")
        next = str(next)

        if next.islower():
            print("AC")
            exit()

print("WA")

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

S = list(input())

def ok(s):
    if S[0] != 'A':
        return False
    if S[-1] == 'C' or S[1] == 'C':
        return False

    if len(list(filter(lambda x : x == 'C', S[2:]))) != 1:
        return False


    if list(map(lambda x: x.lower() if x not in ['A', 'C'] else x, s)) != s:
        return False

    return True

print("AC" if ok(S) else "WA")

Submission status: Accepted

Solution code:
ans = "WA"
s = list(input())
if s[0] == "A":
    c_index = [i for i, x in enumerate(s[2:-1]) if x == 'C']
    if len(c_index) == 1:
        s.pop(c_index[0] + 2)
        s.pop(0)
        s = "".join(s)
        if s.islower():
            ans = "AC"
print(ans)

Submission status: Accepted

Solution code:
S = list(input())
a_flag = 0
c_flag = 0
c_count = 0
flag2 = 0
if S[0] == 'A':
    a_flag += 1
for i in range(2, len(S)-1):
    if S[i] == 'C' and i == 2:
        c_flag += 1
        c_count += 1
    elif S[i] == 'C':
        c_flag += 1
        c_count += 1
    elif S[i].isupper():
        flag2 += 1

if S[len(S) - 1].isupper() or S[1].isupper():
    flag2 += 1
if a_flag == 1 and c_flag == 1 and flag2 == 0 and c_count == 1:
    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 = 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()
Cs = [i for i, c in enumerate(S) if c == "C" and 2 <= i <= len(S) - 2]
if S[0] == "A" and len(Cs) == 1 and (S[1 : Cs[0]] + S[Cs[0] + 1 :]).islower():
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
# input
S = input()

# check
check_one = S[0] == "A"
check_two = S[2:-1].count("C") == 1
check_three = False not in [True if s in ["A", "C"] or s.lower() == s else False for s in list(S)]

if False not in [check_one, check_two, check_three]:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()
ok = True
if s[0] != 'A': ok = False
if s[1].isupper(): ok = False
if s[-1].isupper(): ok = False
c = 0
for si in s[2:-1]:
    if si == 'C': c += 1
print('AC' if ok and c==1 else 'WA')

Submission status: Accepted

Solution code:
s = input()
ok = True
if s[0] != 'A': ok = False
if s[1] != s[1].lower(): ok = False
if s[-1] != s[-1].lower(): ok = False
c = 0
for si in s[2:-1]:
    if si == 'C': c += 1
if c != 1: ok = False
print('AC' if ok else 'WA')

Submission status: Accepted

Solution code:
#104
s=input()
if s[0]!="A":
    print("WA")
elif "C" not in s[2:-1] or s[2:-1].count("C")!=1:
    print("WA")
elif s[1]==str.upper(s[1]):
    print("WA")
elif (s[1:2]+s[-1]).strip("C")==str.lower((s[1:2]+s[-1]).strip("C")):
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()
ok = True
if s[0] != 'A': ok = False
c = 0
# print(s)
for si in s[2:-1]:
    # print('si',si)
    if 'C' == si:
        c += 1
if c != 1: ok = False

for si in s[1:2]+s[-1]:
    # print('si2',si,si.lower())
    if si != si.lower(): ok = False

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

Submission status: Accepted

Solution code:
S = list(input())

ans = 'AC'
if S[0] == 'A':
    del S[0]
    for i in range(1, len(S)-1):
        if S[i] == 'C':
            del S[i]
            ans = 'AC'
            break
        else:
            ans = 'WA'
    for j in range(len(S)):
        if S[j].isupper():
            ans = 'WA'
else:
    ans = 'WA'
print(ans)

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:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = list(input())

if S[0] == "A" and "C" in S[2:-1]:
	S.remove("A")
	S.remove("C")
else:
	print("WA")
	exit()

for x in S:
	if not x in ascii_lowercase:
		print("WA")
		exit()
else:
	print("AC")

Submission status: Accepted

Solution code:
s = input()
if s[0] != 'A':
	print("WA")
	exit()
else:
	s = s[1:]
if 'C' not in s[1:-1]:
	print("WA")
	exit()
else:
	i = s.index('C')
	s = s[:i] + s[i+1:]
print("AC" if s.islower() else "WA")

Submission status: Accepted

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

Submission status: Accepted

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

if s.count('C', 2, -1) != 1:
    print('WA')
    exit()

s2 = s[1:].replace('C', '')
if not s2.islower():
    print('WA')
    exit()

print('AC')

Submission status: Accepted

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

import collections
cnt = collections.Counter(s[2:-1])
if cnt['C'] != 1:
    print('WA')
    exit()

s2 = s[1:].replace('C', '')
if not s2.islower():
    print('WA')
    exit()

print('AC')

Submission status: Accepted

Solution code:
s=input()
boo=True
if s[0]!='A':
    boo=False
C=0
for i in range(2,len(s)-1):
    if s[i]=='C':
        C+=1
if C>1 or C<1:
    boo=False
l=0
for i in range(len(s)):
    if s[i].lower()!=s[i]:
        l+=1
if l>2 or l<2:
    boo=False
if boo:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

ccnt=0
for i in range(len(s)):
    if i==0:
        if s[i]!="A":
            print("WA")
            break
        else:
            continue

    elif 2<=i<=len(s)-2 and s[i]=="C":
        ccnt+=1
    elif not s[i] in al:
        print("WA")
        break
else:
    if ccnt==1:
        print("AC")
    else:
        print("WA")

Submission status: Accepted

Solution code:
# coding: utf-8
S = input()
if S[0] == 'A' and 'C' in S[2:-1] and S[1:S.find('C')].islower() is True and S[S.find('C')+1:].islower() is True:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
s = input()
#print(s[3:-2])
if(s[0] =="A"):
  if(s[2:-1].count("C") == 1):
    a = s.index("C")
    s = list(s)
    del s[0]
    del s[a-1]
    s = ''.join(s)
    if(s.islower()):
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")
#print(tmp)

Submission status: Accepted

Solution code:
s=input()
flag=True
count=0

if(s[0]!='A'):
    flag=False

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

for i in s:
    if(i.islower()==False and i!='A' and i!='C'):
        flag=False

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=list(input())
l=len(S)
if S[0]!='A':
  print('WA')
  exit()
if S.count('C')!=1:
  print('WA')
  exit()
if S.index('C')<2 or l-2<S.index('C'):
  print('WA')
  exit()
  
S.remove('A')
S.remove('C')
s=''.join(S)
if s.islower()==True:
  print('AC')
else:
  print('WA')

Submission status: Accepted

Solution code:
def resolve():
	s = input()
	if s[0] != 'A':
		print('WA')
		return
	cnt = False
	for i in s[2:-1]:
		if i == 'C':
			cnt += 1
	if cnt != 1:
		print('WA')
		return
	for i in s:
		if i == 'A' or i == 'C':
			continue
		if i.isupper():
			print('WA')
			return
	print('AC')
resolve()

Submission status: Accepted

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

print('WA')

Submission status: Accepted

Solution code:
S = input()
N = len(S)
out = "AC"
if S[0]!="A":
    out = "WA"
cnt = 0
for i in range(2,N-1):
    if S[i]=="C":
        cnt+=1
if cnt!=1:
    out = "WA"

al=[chr(ord('a') + i) for i in range(26)]

for i in range(1,N-1):
    if S[i]!="C" and S[i] not in al:
        out = "WA"
if S[N-1] not in al:
    out = "WA"

print(out)

Submission status: Accepted

Solution code:
S = input()
N = len(S)
f = True
# first condition
if S[0] != "A":
    f = False
# 2nd condition
c = 0
for i in range(2, N-1):
    if S[i] == "C":
        c += 1
if c != 1:
    f = False

# 3rd cindition
for i in S:
    if i not in "AC":
        if i != i.lower():
            f = False
            break
if f:
    print("AC")
else:
    print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
l=[]
L=[s[0]]
for i in range(2,len(s)-1):
    if s[i]=='C':
        L.append(s[i])
    else:
        l.append(s[i])
komoji=''.join(l)
komoji+=(s[1]+s[len(s)-1])

print('AC' if L==['A','C'] and str.islower(komoji) else '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")
    
    if "".join(s).lower() == "".join(s):
        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:
    s.remove("A")
    s.remove("C")
    if "".join(s).lower() == "".join(s):
        print("AC")
    else:
        print('WA')
else:
    print("WA")

Submission status: Accepted

Solution code:
s=input()
#print(s[1]+s[2:2+s[2:-1].index("C")]+s[s[2:-1].index("C")+1:])
if s[0]=="A" and s[2:-1].count("C")==1:
    if (s[1]+s[2:2+s[2:-1].index("C")]+s[s[2:-1].index("C")+3:]).islower():
        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:
    s.remove("A")
    s.remove("C")
    
    if "".join(s).lower() == "".join(s):
        print("AC")
    else:
        print('WA')

else:
    print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
count = 0
if S[0] == 'A':
    S[0] = S[0].lower()
else:
    print('WA')
    exit()

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

if count == 0:
    print('WA')
    exit()

for i in range(len(S)):
    if S[i] != S[i].lower():
        print('WA')
        exit()
print('AC')

Submission status: Accepted

Solution code:
s = input()
ans = 'WA'
if s[0]=='A' and s.count('C')==1 and s.index('C') in range(2,len(s)-1) and s[1:].replace('C','c') == s[1:].lower():
    ans = 'AC'   
print(ans)

Submission status: Accepted

Solution code:
s = list(input())


if s[0] == "A":
    if len([True for c in s[2:-1:] if c == "C"]) == 1:
        s.remove("A")
        s.remove("C")
        for c in s:
            if not c.islower():
                print("WA")
                exit()
        print("AC")
        exit()
print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

if S[1].isupper():
    print("WA")
    exit()

if S[-1].isupper():
    print("WA")
    exit()

ok = False
for i in range(2, len(S) - 1):
    if S[i].isupper():
        if ok:
            print("WA")
            exit()
        else:
            ok = True
if ok is False:
    print("WA")
else:
    print("AC")

Submission status: Accepted

Solution code:
S = input()

if S[0] != "A":
  print("WA")
  exit()
if S[1] == "C":
  print("WA")
  exit() 
if S[-1] == "C":
  print("WA")
  exit() 
if "C" not in S:
  print("WA")
  exit()
x = S.index("C")
if "C" in S[x+1:]:
  print("WA")
  exit()
if S[1:x]+S[x+1:] != (S[1:x]+S[x+1:]).lower():
  print("WA")
  exit()

print("AC")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
bl = True
if S[0] != 'A':
    bl = False
if S[2:-1].count('C') != 1:
    bl = False
if S.count('C') != 1:
    bl = False
for s in S[1:]:
    if s == 'C':
        continue
    if not s.islower():
        bl = False    

print('AC' if bl else '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()
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:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

s = S()
if s[0] == 'A' and s[2:-1].count('C') == 1:
    t = list(s[1:])
    t.remove('C')
    if all(x.islower() for x in t):
        print('AC')
        exit()

print('WA')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    S = input()
    flag = True
    if S[0] != 'A' or S[2:-1].count('C') != 1:
        flag = False
    for i in range(len(S)):
        if S[i] not in 'ACabcdefghijklmnopqrstuvwxyz':
            flag = False
            break
    print('AC' if flag else 'WA')
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

c1= c2 = 0
for i in s[2:]:
    if i == 'C':
        c1 += 1
    else:
        if i!=i.lower():
            c2 +=1
if s[0] == 'A' and s[1] == s[1].lower() and c1==1 and c2==0 and s[-1] != 'C':
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
s = input()
if s[0] != 'A':
  print('WA')
  exit()
sho = ord('a')
ok = 0
for i in s[2: len(s) - 1]:
  if ord(i) < sho:
    if ord(i) == ord("C"):
      ok += 1
    else:
      print("WA")
      exit()
if ord(s[1]) < sho or ord(s[len(s) - 1]) < sho:
  print("WA")
  exit()
if ok == 1:
  print("AC")
else:
  print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)

inf = 10 ** 15
mod = 10 ** 9 + 7

s = input()
length = len(s)
if s[0] == 'A':
    tmp = s[2:length-1]
    count = 0
    if s[1].isupper():
        print('WA')
        sys.exit()
    for c in tmp:
        if c.isupper():
            if c == 'C':
                count += 1
            else:
                print('WA')
                sys.exit()
    if count == 1 and s[-1].islower():
        print('AC')
    else:
        print('WA')

else:
    print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
if S[0] != 'A':
    print('WA')
    exit()
if len([s for s in S[2:-1] if s == 'C']) != 1:
    print('WA')
    exit()
SL = [s for s in S if s not in ['A', 'C']]
if not all([sl.islower() for sl in SL]) or len(SL) + 2 != len(S):
    print('WA')
    exit()
print('AC')

Submission status: Accepted

Solution code:
s = input()

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