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:
"""
author : halo2halo
date : 23, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

S = list(readline().decode('utf8').rstrip())
bl = S[0] == 'A'
bl &= ('C' in S[2:-1])

if bl:
    S.remove('A')
    S.remove('C')

bl &= all('a' <= x <= 'z' for x in S)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

ans = 'AC'

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

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

if count != 1:
    ans = "WA"

print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S = list(input())
if S[0] != "A":
  print("WA")
  exit()
count = 0
for i in range(2,len(S)-1):
  if S[i] == "C":
    count += 1
if count != 1:
  print("WA")
  exit()
S2 = [str.upper() for str in S]
count = 0
for i in range(len(S)):
  if S[i] == S2[i]:
    count += 1
if count != 2:
  print("WA")
else:
  print("AC")

Submission status: Accepted

Solution code:
s = input()

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

print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

S = input()

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

print('WA')

Submission status: Accepted

Solution code:
S = input()
flag = True

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

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

c = 0
for s, s_lower in zip(S, S.lower()):
    if s != s_lower:
        c += 1

if c != 2:
    flag = False

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

Submission status: Accepted

Solution code:
from sys import exit

S = input()
if S[0] != 'A' or S[1].isupper() or S[-1].isupper():
    print('WA')
    exit()
c = 0
for s in S[2:-1]:
    if s == 'C':
        c += 1
    elif s.isupper():
        print('WA')
        exit()

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

Submission status: Accepted

Solution code:
s=input()
li = [s[i] for i in range(2,len(s)-1) if s[i] == "C"]
alphabet = [chr(i) for i in range(97, 97+26)]
if s[0] != "A" or len(li) != 1:
  print("WA")
else:
  for i in range(1,len(s)):
    if s[i]=="C" or s[i] in alphabet:
      continue
    else:
      print("WA")
      exit()
  print("AC")

Submission status: Accepted

Solution code:
S=input()
if S[0]=='A':
  if 'C' in S[2:-1]:
    S=S.lstrip('A')
    S=S.replace('C','',1)
    if str.islower(S):
      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 and S.count("C") == 1:
        n = len(S)
        for i in range(len(S)):
            if S[i] == "A" or S[i] == "C":
                pass 
            elif S[i].isupper() == True:
                n -= 1
                break
        if n == len(S):
            ans = "AC"

print(ans)

Submission status: Accepted

Solution code:
s = input()

if s[0] != 'A':
  print("WA")
elif s.count("C") != 1:
  print("WA")
elif s[2:-1].count('C') != 1:
  print("WA")
elif not(((s.replace('A','a')).replace('C','c')).islower()):
    print("WA")
else:
    print("AC")

Submission status: Accepted

Solution code:
import re
s = input()
cnt = 0
if (s[2:-1].count('C') != 1):
    print('WA')
    exit(0)
for i in range(len(s)):
    if (s[i] >= 'A' and s[i] <= 'Z'):
        cnt += 1
        if (cnt >= 3):
            print('WA')
            exit(0)
print('AC') if s[0]=='A' else print('WA')

Submission status: Accepted

Solution code:
import string

S = input()
re_S = set(S)-set("AC")
bl = S[0] == "A"
bl &= (S[2:-1].count("C") == 1)
bl &= (re_S <= set(string.ascii_lowercase ))

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = list(str(input()))

flag = []
for i in range(3):
    flag.append(False)
small = ['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':
    flag[0] = True

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

if flag[0] and flag[1]:
    count2 = 0
    for i in range(1, len(s)):
        if i != tmp and (s[i] in small):
            count2 += 1
    if count2 == len(s) - 2:
        flag[2] = True

if flag[0] and flag[1] and flag[2]:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
import sys
from string import ascii_uppercase

INPUT = lambda: sys.stdin.readline().rstrip()

sys.setrecursionlimit(10 ** 9)


def main():
    S = INPUT()
    n = len(S)

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

    for i in range(2, n-1):
        if S[i] == 'C':
            idx = i
            break
    else:
        print("WA")
        sys.exit()

    for i in range(n):
        if i == 0 or i == idx: continue
        if S[i] in ascii_uppercase:
            print("WA")
            sys.exit()
    else:
        print("AC")

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

ans = "WA"

if S[0] != "A":
  print(ans)
  
else:
  if S[2:len(S) - 1].count("C") != 1:
    print(ans)
  else:
    s = S.index("C")
    SS = S[1:s] + S[s + 1:]
    if SS.islower() == False:
      print(ans)
    else:
      print("AC")

Submission status: Accepted

Solution code:
s = input()
is_a = False
cnt_c = s[2:-1].count("C")
cnt_l = 0
if s[0] == "A":
    is_a = True
else:
    pass
for letter in s:
    if letter.isupper():
        cnt_l += 1
    else:
        continue
if is_a == True and cnt_c == 1 and cnt_l == 2:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = input()
AC = S[0]=='A' and S[2:-1].count('C')==1
for c in S[1:]:
    AC *= (c>='a' and c<='z') or c=='C'
print('AC' if AC else 'WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
letters = 'abcdefghijklmnopqrstuvwxyzAC'
print('AC' if s[0] == 'A' and s[2:-1].count('C') == 1 and all(c in letters for c in s) else 'WA')

Submission status: Accepted

Solution code:
def examA():
    R = I()
    if R<1200:
        ans = "ABC"
    elif R<2800:
        ans = "ARC"
    else:
        ans = "AGC"
    print(ans)
    return

def examB():
    S = SI(); N = len(S)
    ans = "AC"
    if not S[0]=="A":
        ans = "WA"
    flag = False
    for i in range(2,N-1):
        if S[i]=="C":
            flag = True
    if not flag:
        ans = "WA"
    num = 0
    for i in S:
        if ord("A")<=ord(i)<=ord('Z'):
            num +=1
    if not num==2:
        ans = "WA"
    print(ans)
    return

def examC():
    return

def examD():
    return

def examE():
    return

def examF():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

t = s[2:-1]
if ('C' not in t or t.count('C') > 1):
   print('WA')
   exit()

s = s[1:]
s = s.replace('C', '')
for x in s:
   if (x.islower() == False):
      print('WA')
      exit()
print('AC')

Submission status: Accepted

Solution code:
s=input()
flag = "AC"
if s[0] != "A":
    flag = "WA"
else:
    if not "C" in s[2:-1]:
        flag = "WA"
    else:
        ls = [c for c in s]
        ls.remove("A")
        ls.remove("C")
        if not "".join(ls).islower():
            flag = "WA"
        #for c in ls:
            #if c.isupper():
                #flag = "WA"
print(flag)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input().strip())
flag = False

if S[0] == "A" and "C" in S[2:-1]:
    count = 0
    for s in S:
        #if s < "a":
        if "A" <= s <= "Z":
            count += 1
    if count == 2:
        flag = True
if flag:
    print("AC")
else:
    print("WA")

Submission status: Accepted

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

ss = ""
count = 0
for i in range(2, len(s)-1):
    if s[i] == "C":
        count += 1
    else:
        ss += s[i]
sss = s[1]+ss+s[-1]
if count==1:
    if sss.islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")
    exit()

Submission status: Accepted

Solution code:
s = list(input())
ans = []
flag = 0
counter = 0
for i in range(len(s)):
    if (i == 0 and s[i] == "A"):
        ans.append(1)
        counter = 1
    elif (i == 0 and s[i] != "A" and s[i].isupper()):
        print("WA")
        exit()
    elif (2 <= i <= len(s) - 2 and s[i] == "C" and flag ==0):
        ans.append(1)
        flag = 1
        counter = 1
    elif (2 <= i <= len(s) - 2 and s[i] == "C" and flag == 1):
        print("WA")
        exit()
    elif (counter == 0 and s[i].isupper()):
        print("WA")
        exit()
    counter = 0
if (len(ans) == 2):
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
S = input()


def judge(sent):
    tmp = sent[1]
    tmp_last = sent[-1]
    if sent[0] != 'A' or tmp.isupper() or tmp == 'C' or tmp_last.isupper() or tmp_last == 'C':
        return False

    part = list(sent[2:-1])
    if sum(['C' in s for s in part]) != 1:
        return False
    idx = part.index('C')
    part.pop(idx)
    if any([s.isupper() for s in part]):
        return False
    return True


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

Submission status: Accepted

Solution code:
S = input()
print("WAAC"[S[0]=="A" and S[2:-1].count("C")==1 and len(list(filter(str.isupper, S)))==2::2])

Submission status: Accepted

Solution code:
S = input()
flg = True
cnt = 0

for i, c in enumerate(S):
    if i == 0 and c != 'A':
        flg = False
    if i == 1:
        if c == 'C' or c.islower == False:
            flg = False
    if i > 0 and i != len(S) - 1:
        if c == 'C':
            cnt += 1
        elif c.islower() == False:
            flg = False
    if i == len(S) - 1:
        if c.islower() == False or c == 'C':
            flg = False

if cnt == 1 and flg == True:
    print('AC')
else:
    print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
S = list(input().strip())
flag = False

if S[0] == "A" and "C" in S[2:-1]:
    count = 0
    for s in S:
        if s < "a":
            count += 1
    if count == 2:
        flag = True
if flag:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
A = list(input())
L = len(A)

ans = 'WA'
flag = 0
f = 0
j = 0

if A[0] == 'A':
    if A[0].isupper():
        flag = flag + 1
#print(flag)
count = 0
i=2
while(1):
    if A[i] == 'C':
        if A[i].isupper():
            count = count + 1
    i = i + 1
    if (L-2-i < 0):
        break
#print(count)
if count == 1:
    flag = flag + 1
#print(flag)
count = 0
for i in range(1,L):
    #print(A[i].isupper())
    if A[i].isupper():
        count = count + 1
#print(count)
if count == 1:
    flag = flag + 1
#print(flag)
if flag == 3:
    ans = 'AC'

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
s = input()
fist = s.replace('A', '').replace('C', '')

if not fist.islower():
    print('WA')
else:
    seco = s[2:-1]
    cnt = Counter(seco)
    if not cnt['C'] == 1:
        print('WA')
    else:
        if s[0] == 'A':
            print('AC')
        else:
            print('WA')

Submission status: Accepted

Solution code:
s = list(input())

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

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

cnt = 0
for i in s:
    
    if 'A' <= i <= 'Z':
        cnt += 1

if cnt != 2:
    ans = 'WA'

print(ans)

Submission status: Accepted

Solution code:
S = list(input())
last = len(S) - 1

S_head = S[0]

S_bothEnd = [S[0],S[1],S[last]]
S_center = list(set(S)-set(S_bothEnd))

S_clone = S
if "A" in S_clone:
  S_clone.remove('A')
if "C" in S_clone:
  S_clone.remove('C')

evalLow = "".join(S_clone)

if S_head == "A" and S_center.count("C")  == 1 and evalLow.islower() == 1:
  print('AC')
else:
  print('WA')

Submission status: Accepted

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

for i in range(len(s)):
    if s[i].isupper():
        count += 1
#print(count)

if s[0] == 'A':
    for i in range(2 , len(s)-1):
        #print(s[i])
        if s[i] == "C" and count == 2:
            flag = 1
if flag == 1:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
# ABC104B - AcCepted
def main():
    S = input().rstrip()
    flags = [S[0] == "A", S[2:-1].count("C") == 1, S.translate(str.maketrans({"A": None, "C": None})).islower()]
    print("AC" if all(flags) else "WA")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))


s = list(input())
ans = True
li = list("abcdefghijklmnopqrstuvwxyzC")

if s[0]!="A":
    ans = False
memo = s[2:-1]
if not("C" in memo):
    ans = False
C_cnt = 0
for i in range(1,len(s)):
    if not(s[i] in li):
        ans = False
    if s[i] == "C":
        C_cnt += 1

if ans and C_cnt==1:
    print("AC")
else:
    print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
ans="AC"
if s[0]!="A":
    ans="WA"
c=0
idx=0
for i in range(2,len(s)-1):
    if s[i]=="C":
        c+=1
        idx=i
if c!=1:
    ans="WA"
small={"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"}
for i in range(1,len(s)):
    if i!=idx:
        if s[i] not in small:
            ans="WA"
            break
print(ans)

Submission status: Accepted

Solution code:
import re

S = input()
if S[0] != "A" or len(re.findall("C", S[2:-1])) != 1:
    print("WA")
    exit()

if len(re.findall("[A-Z]", S)) != 2:
    print("WA")
else:
    print("AC")

Submission status: Accepted

Solution code:
s = list(input())

if s[0]!="A":
    print("WA")
    exit()
else:
    del s[0]
cnt=0
for i in range (1,len(s)-1):
    if s[i]=="C":
        cnt+=1
    
if cnt==1:
    del s[s.index("C")]
else:
    print("WA")
    exit()

for i in range(len(s)):
    if s[i].islower()==True:
        continue
    else:
        print("WA")
        exit()

print("AC")

Submission status: Accepted

Solution code:
import sys

s = input()

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

if s[1] < "a" or s[1] > "z":
    print("WA")
    sys.exit(0)


sub = s[2:-1]
has = False
for c in sub:
    if not has and c == "C":
        has = True

    elif "a" <= c <= "z":
        continue

    else:
        has = False
        break

if not has:
    print("WA")
    sys.exit(0)

if "a" <= s[-1] <= "z":
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s = input()

flag = True

if s[0] != "A":
    flag = False

if not "C" in s[2:-1] or not s[2:-1].count("C") == 1:
    flag = False
    
if s.replace("A", "").replace("C", "").islower() == False:
    flag = False

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
S = input()
a = "WA"
count = 0
b = 0
if S[0] == 'A' :
    k = S[1]
    K = k.lower()
    if k == K :
        for i in range(2,len(S)-2) :
            if S[i] == "C" :
                count +=1
        for i in range(2,len(S)) :
            if S[i] != "C" :
                k = S[i]
                K = k.lower()
                if k != K :
                    b = 1
                    break
        if count == 1 and b == 0 :
            a = "AC"
print(a)

Submission status: Accepted

Solution code:
S = input()

if S[0]!='A':
  print('WA')
  exit()
else:
  S_withoutA = S.replace('A','')

S_part = [i for i in S[2:-1] if i=='C']
if len(S_part) != 1:
  print('WA')
  exit()
else:
  S_withoutAC = S_withoutA.replace('C','')

if S_withoutAC.islower():
  print('AC')
else:
  print('WA')

Submission status: Accepted

Solution code:

s = list(input())
status = 0
c = 0
word = [chr(ord('A') + i) for i in range(26)]

if s[0] != "A":
    status = 1
elif s.count("C") == 0:
    status = 1
else:
    if s.count("C") == 1 and 2<=s.index("C")<=len(s)-2:
        del s[0]
        del (s[s.index("C")])
        for i in word:
            if i in s:
                status = 1
                break
    else:
        status = 1

if status == 0:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:

s = list(input())
status = 0
c = 0
word = [chr(ord('A') + i) for i in range(26)]

#print(s.count("C"))
#print(s.index("C"))
#print(len(s)-2)
#print(s)

if s[0] != "A":
    status = 1
elif s.count("C") == 0:
    status = 1
else:
    if s.count("C") == 1 and 2<=s.index("C")<=len(s)-2:
        del s[0]
        del (s[s.index("C")])
        for i in word:
            if i in s:
                status = 1
                break
    else:
        status = 1

if status == 0:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
import re

txt = input()
z = re.match("^A[a-z]+C[a-z]+$", txt)

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

Submission status: Accepted

Solution code:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

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

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

s = sys.stdin.buffer.readline().decode().rstrip()

ok = True
ok &= s[0] == 'A'
ok &= s[2:-1].count('C') == 1
uc = 0
for c in s:
    if c in string.ascii_uppercase:
        uc += 1
ok &= uc == 2
if ok:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
s = list(input())

c = 0
f = len(s)
if s.count('C') == 1:
    d = s.index('C')
else:
    d = 0
for i in range(0,len(s)):
    if s[i].isupper() == True:
        c += 1
if s[0] == 'A':
    if d < f-1 and d > 1:
        if c == 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:-1].count('C') == 1) and (s.replace('A','a').replace('C','a').islower()):
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
S = list(str(input()))

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

cflag = False
for i in range(2, len(S)-1) :
  #print(S[i])
  if S[i] == "C" :
    S[i] = "c"
    cflag = True
    break

if cflag == False :
  print ("WA")
  exit()
    
for j in range(len(S)) :
  if S[j].islower() == False :
    print ("WA")
    exit()
print ("AC")

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

def wa():
    print('WA')
    exit(0)

for i in range(len(s)):
    #print(str(s[i]).isupper())
    if i == 0:
        if s[i] != 'A':
            wa()
    elif s[i] == 'C':
        count += 1
        if not (2 <= i < len(s)-1):
            wa()
        elif count > 1:
            wa()
    elif s[i].isupper():
        wa()
if count < 1:
    wa()

print('AC')

Submission status: Accepted

Solution code:
# coding: utf-8

s = input().rstrip()

def isValid(s:str):
    if s[0] != "A":
        return False
    if s[1] == s[1].upper():
        return False
    sub = s[2:-1]
    if len([i for i in sub if i == "C"]) != 1:
        return False

    sub2 = s[1] + sub.replace("C", "") + s[-1]
    if sub2 != sub2.lower():
        return False
    return True

ans = "AC"

if not isValid(s):
    ans = "WA"

print(ans)

Submission status: Accepted

Solution code:
import sys

s = sys.stdin.readline().rstrip()

def main():
    if s[0] == 'A':
        if 'C' in s[2:-1]:
            cnt = 0
            for letter in s:
                if 65 <= ord(letter) <= 90:
                    cnt += 1
            if cnt == 2:
                return 'AC'
    return 'WA'

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

Solution code:
import re
S=input()
flg=True
if re.match(r"^[^A]",S):
  flg=False
if len(re.findall(r"C",S[2:-1])) != 1:
  flg=False
for i in range(1,len(S)):
  if S[i]!="C" and S[i].isupper():
    flg=False
print("AC" if flg else "WA")

Submission status: Accepted

Solution code:
S=input()
flg=True
if S[0]!="A":
  flg=False
if S[2:-1].count("C")!=1:
  flg=False
for i in range(1,len(S)):
  if S[i]=="C" and i!=len(S)-1:
    continue
  if S[i].isupper():
    flg=False
print("AC" if flg 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","a",1).islower()==True:
  print('AC')
else:
  print('WA')

Submission status: Accepted

Solution code:
s=input()

ans=False

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

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

Submission status: Accepted

Solution code:
s=list(input())

if s[0]=='A':
    if s.count('C')==1 and s[1]!='C' and s[len(s)-1]!='C':
        s.remove('A')
        s.remove('C')
        s=''.join(s)
        if s.islower()==True:
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')

Submission status: Accepted

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

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

if count != 1:
    flag = False

for i in range(len(S)):
    if S[i] == "C" or S[i] == "A":
        continue
    if S[i] != S[i].lower():
        flag = False

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

Submission status: Accepted

Solution code:
s = input()

flag = [0] * 3

if s[0] == 'A':
	flag[0] += 1
	s = 'a' + s[1:]

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

if Ccnt == 1:
	flag[1] = 1

if s.islower() is True:
	flag[2] = 1


if sum(flag) == 3:
	print('AC')
else:
	print('WA')

Submission status: Accepted

Solution code:
s = str(input())
cnt = 0
lst = []

if s[0]=='A' and s.count('C', 2, -1)==1:

    for i in range(1,len(s)):
        if s[i] != s[s.find('C',2, -1)]:
            lst.append(s[i])

    t = ''.join(lst)

    if t== str(t.upper()).lower():
        print('AC')
    else:
        print('WA')

else:
    print('WA')

Submission status: Accepted

Solution code:
s = input()
ans = "AC"
cnt = 0

for i in range(len(s)):
    if i == 0:
        if s[i] != "A":
            ans = "WA"
            break
    elif 2 <= i <= len(s)-2 and s[i] == "C":
        cnt += 1
    elif s[i] != s[i].lower():
        ans = "WA"
        break
else:
    if cnt != 1: ans = "WA"

print(ans)

Submission status: Accepted

Solution code:
S=input()

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

Submission status: Accepted

Solution code:
S = list(input())

flag = 0

if S[0] == 'A':
    if S[2:-1].count("C") == 1:
        S.remove("A")
        S.remove("C")
        for s in S:
            if s.islower():
                continue
            else:
                flag = 1
                break
        if flag == 0:
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
S = list(input().rstrip())
N = len(S)
cnt = 0
for i in S:
    cnt += i.isupper()
if cnt != 2:
    print("WA")
    sys.exit()
if S[0] != "A":
    print("WA")
    sys.exit()
if "C" not in S[2:N-1]:
    print("WA")
    sys.exit()
print("AC")

Submission status: Accepted

Solution code:
s = list(input())
hani = (ord("a"),ord("z"))

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

del s[0]
cc = 0
for i in range(1,len(s)-1):
    if s[i] == "C":
        cc+=1
        d = i
        

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

del s[d]

for i in s:
    if not hani[0] <= ord(i) <= hani[1]:
        print("WA")
        exit()

print("AC")

Submission status: Accepted

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

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()
L=len(S)
ans='AC'

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

cnt=0

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

if cnt != 1:
    ans='WA'

print(ans)

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
S = input()

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


if not S[1].islower() or not (S[-1].islower()):
        #wether second charcter lowercase 
        print("WA")
        exit()


flag = False
for i in range(2, len(S)-1):
        if flag == True and S[i] == "C":
                print("WA")
                exit()
        if flag == False and S[i] == "C":
                flag = True
                continue
        if not S[i].islower():
                print("WA")
                exit()
if flag:
        print("AC")
else:
        print("WA")

Submission status: Accepted

Solution code:
import re

ptn = re.compile(r'A[a-z]+C[a-z]+')
print('AC' if re.fullmatch(ptn, input()) else 'WA')

Submission status: Accepted

Solution code:
s=input()

def check(s):
    if not s[0] == 'A':
        return False
    if not s[2:-1].count('C') == 1:
        return False
    
    count=0
    
    for i in s[1:]:
        if not i.lower() == i:
            count+=1
            if count>1:
                return False
        
    return True
print("AC" if check(s) else "WA")

Submission status: Accepted

Solution code:
s=input()
flg=True
if s[0]!="A":
    flg=False
cnt=0

for i in s[2:-1]:
    if i=="C":
        cnt+=1
#print(cnt)
if cnt!=1:
    flg=False
cnt=0
for i in s:
    if i.isupper():
        cnt+=1
if cnt!=2:
    flg=False
if flg:
    print("AC")
else:
    print("WA")