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:
# INPUT
a = input()


# PROCESS
answer = ""

if(a[0] != "A"):
  answer = "WA"
else:
  a_list = list(a)
  b_list = a[2:-1]
  if (not b_list.count("C") == 1):
    answer = "WA"
  else:
    c = a[1:]
    c_index = c.find("C")
    c_list = list(c)
    c_list.pop(c_index)
    c_join = "".join(c_list)

    if(c_join.islower()):
      answer = "AC"
    else:
      answer = "WA"

# OUTPUT
print(answer)

Submission status: Accepted

Solution code:
S = input()

count = 0
if S[0] == 'A' and 'C' in S[2: -1]:
    for v in S:
        if v.isupper():
            count += 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S= input()

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

SS = S[1:C_posi] + S[C_posi+1:]

if SS.islower() == False:
    print('WA')
    exit()

print('AC')

Submission status: Accepted

Solution code:
S = [s for s in input()]
#1文字目がA
if S[0] == "A":
    #3文字目〜末尾から2文字目の走査
    if "C" in S[2:-1]:
        S.remove("A")
        S.remove("C")
        S = "".join(S)
        if S.islower():
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

Solution code:
def priwa():
    print('WA')


# input
s = list(input())
# calc
if s[0] == 'A':
    s.pop(0)
    if s[0].islower() == True:
        s.pop(0)
        if s[0:len(s)-1].count('C') == 1:
            s.remove('C')
            for i in s:
                if i.islower() == False:
                    priwa()
                    exit()
            print('AC')
        else:
            priwa()
    else:
        priwa()
else:
    priwa()

Submission status: Accepted

Solution code:
s = list(input())

a = [chr(i) for i in range(97, 97+26)]
A = [chr(i) for i in range(65, 65+26)]

flg = "AC"

if not s[0] == "A":
    flg = "WA"

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

b = set(s)-set(["A","C"])

if not b<=set(a):
    flg = "WA"

print(flg)

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
import re
S = input()
if not S[0] == 'A':
    print('WA')
elif len(S) > 4 and S[2:-1].count('C') != 1:
    print('WA')
elif len(S) == 4 and S[2:].count('C') != 1:
    print('WA')
elif len(re.findall('[A-Z]', S)) != 2:
    print('WA')
else:
    print('AC')

Submission status: Accepted

Solution code:
# 2019/06/07
# AtCoder Beginner Contest 104 - B

# Input
s = input()

# Check 1-2
if s[0] == "A" and s[1].islower() == True and s[len(s)-1].islower() == True:
    ccnt = 0
    bflg = False
    for i in range(2, len(s)-1):
        if s[i] == "C":
            ccnt += 1
        elif s[i].islower() == False:
            bflg = True
            break
        if bflg == False and ccnt == 1:
            ans = "AC"
        else:
            ans = "WA"
else:
    ans = "WA"

# Output
print(ans)

Submission status: Accepted

Solution code:
S=input()
S1=list(str(s)  for s in S)
A=1
B1=0
B2=0
C=1
if S1[0] != 'A':
  A=0
  
for s in S1[2:-1]:
  if s=='C':
    B1=1
    B2+=1

for s in S1[1::]:
  if s=='C':
    pass
  elif s.isupper():
    C=0
    
if A==1 and B1==1 and B2==1 and C==1:
    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()
Slist = list(S)
L = len(S)
if S[0] == 'A' and 'C' in S[2:L-1] and Slist.count('C') == 1:
    Slist.remove('A')
    Slist.remove('C') 
    flag = True
    for s in Slist:
        if s.isupper():
            flag = False
    if flag:
        print('AC')
        exit()
print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import copy
s = list(input())
Ccnt = 0
if s[0] == 'A' :
	for i in copy.copy(s[2:-1]) :
		if i == 'C' :
			Ccnt += 1
			s.remove(i)
	s.remove(s[0])
	if Ccnt == 1 and ''.join(s) == ''.join(s).lower() :
		print('AC')
		exit()
print('WA')

Submission status: Accepted

Solution code:
s = input().rstrip()

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

Submission status: Accepted

Solution code:
s=input()
k="WA"
for i in range(2,len(s)-1):
    if s[0]=="A" and "C"==s[i] and s.count("C")==1 and sum([c.isupper() for c in s]) == 2:
        k="AC"
print(k)

Submission status: Accepted

Solution code:
S = [s for s in input()]
if S[0] == "A":
  if "C" in S[2:-1]:
    S.remove("A")
    S.remove("C")
    S = "".join(S)
    if S.islower():
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")

Submission status: Accepted

Solution code:
s=[i for i in input()]
a=0
if s[0]=="A":
    if s[2:-1].count("C")==1:
        s.remove("A")
        s.remove("C")
        S=[i.upper() for i in s]
        if set(S)&set(s)==set():
          a+=1
print("AC" if a==1 else "WA")

Submission status: Accepted

Solution code:
S = input()
if S[0] == 'A' \
    and S[2:len(S) - 1].count('C') == 1 \
    and ''.join([S[i] for i in range(len(S)) if i != 0 and not (2 <= i and i < len(S) - 1 and S[i] == 'C')]).islower():
    print('AC')
else:
    print('WA')

Submission status: Accepted

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

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

del s[number]
del s[0]

for j in s:
    c = j.lower()
    if c == j:
        continue
    else:
        print("WA")
        exit()
print("AC")

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 104 B
S = input()
if S[0] == 'A' and S[2:-1].count('C') == 1:
  C_pos = S[2:-1].find('C') + 2
  S_changed = 'a' + S[1:C_pos] + 'c' + S[C_pos+1:]
  if S_changed.islower():  
    print('AC')
  else:
    print('WA')  
else:
  print('WA')

Submission status: Accepted

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

if s[0] == 'A':
    flag += 1
#print(flag)
a = s.pop(0)
b = s.pop(0)
c = s.pop(-1)

if s.count('C') == 1:
    flag += 1
#print(flag)
if flag ==2:
    s.append(b)
    s.append(c)
    #print(s)
    for i in range(len(s)):
        if s[i].islower():
            count += 1
        #print(count)
    if (count+1) == len(s):
        flag += 1
##print(flag)
if flag == 3:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
S=list(input())

if not S[0]=="A":
  print("WA")
else:
  if not S.count("C") == 1:
    print("WA")
  elif S[-1]=="C" or S[1]=="C":
    print("WA")
  else:
    S.remove('A')
    S.remove('C')
    if str(S).islower():
      print("AC")
    else:
      print("WA")

Submission status: Accepted

Solution code:
S = input()
if S[0] == "A" 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 re

s = input()

if s[0] != "A":
    print("WA")
elif s[2:-1].count("C") != 1:
    print("WA")
elif re.search("[BD-Z]", s) is not None:
    print("WA")
else:
    print("AC")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()


li = "abdefghijklmnopqrstuvwxyz"
li = li.upper()
li = list(li)

if s[0] == "A" and "C" in s[2:-1] and s.count("C") == 1:
    for i in li:
        if i not in s[1:]:
            pass
        else:
            print("WA")
            break
    else:
        print("AC")
else:
    print("WA")

Submission status: Accepted

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

# 1文字目が'A'
if S[0] != 'A':
	ans = 'WA'

# 3文字目-末尾2文字目にCが1つ含まれる
s1 = S[2:-1]
if s1.count('C') != 1:
	ans = 'WA'

# 1文字目の'A'、3-末尾2文字目の'C'以外は小文字
s2 = S[1:].replace('C', '')
s2_lower = s2.lower()
if (s2 != s2_lower) or S.count('C') != 1:
	ans = 'WA'

print(ans)

Submission status: Accepted

Solution code:
S_ = input()
S = list(S_)
flag = True

if S[0] == 'A':
    S.pop(0)
    big = []
    for i in range(1, len(S)-1):
        if S[i] == 'C':
            big.append(i)
    if len(big) == 1:
        S.pop(big[0])
        for s in S:
            if s.isupper():
                flag = False
    else:
        flag = False
else:
    flag = False

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

Submission status: Accepted

Solution code:
import re
S = input()

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

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

Submission status: Accepted

Solution code:
S = input()

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

print('WA')

Submission status: Accepted

Solution code:
S = input()

decAC = False
declow = False
if S[0] == "A" and S[2:-1].count("C") == 1:
    decAC = True

cnt = 0
for ss in S:
    if ss.islower():
        cnt += 1
if cnt == len(S)-2:
    declow = True
    
if decAC and declow:
    print("AC")
else:
    print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
if s[0]=="A" and s[2:-1].count("C")==1:
    sa = s.replace("A","a").replace("C","c")
    sb = s.lower()
    if sa==sb:
        print("AC")
        exit()
print("WA")

Submission status: Accepted

Solution code:
s_list=list(input())

def out_wa():
  print('WA')

if s_list[0]!='A':
  out_wa()
else:
  count=0
  for i in range(2,len(s_list)-1):
    if s_list[i] == 'C':
      count+=1

  if count != 1:
    out_wa()
  else:
    s = ''.join(s_list)
    s=s.replace('A','')
    s=s.replace('C','')
    l_s=s.lower()
    if l_s !=s:
      out_wa()
    else:
      print('AC')

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:
from collections import Counter
s=input()
a=len(s)
counter = Counter(s[2:a-1])
if s[0]!="A":
  print("WA")
  
elif counter["C"]!=1:
  
    print("WA")
else:
  
  s[1:].replace("C","c",1)
  if s[1:].replace("C","c",1).islower()==False:
    print("WA")
  else:
    print("AC")

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

cnt = 0
for c in s:
    if c.isupper():
        cnt = cnt + 1

if cnt != 2:
    print("WA")
    exit()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = raw_input()
flag1 = S[0] == 'A'

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

if not(flag1 and flag2): print 'WA'
else:
	flag3 = True
	for i in range(1, len(S)):
		if i != index:
			n = ord(S[i])
			if n < 97: flag3 = False
	if flag3: print 'AC'
	else: print 'WA'

Submission status: Accepted

Solution code:
S = input()
alp = "abcdefghijklmnopqrstuvwxyz"
alpC = "abcdefghijklmnopqrstuvwxyzC"

ans = "AC"
if S[0] != "A":
    ans = "WA"
countC = 0
for i in S[2:-1]:
    if i == "C":
        countC += 1
    if not i in alpC:
        ans = "WA"
if countC != 1:
    ans = "WA"
if not S[1] in alp:
    ans = "WA"
if not S[-1] in alp:
    ans = "WA"
print(ans)

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:
if __name__ == '__main__':
    S = str(input())

    tmp_S = S[2:len(S)-1]
    tmp_S_2 = S[1] + tmp_S.replace('C', '') + S[len(S)-1]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
S = list(input())
S2=''.join(S)
ans=0
cou=2
Ccou=0
A=S.count('A')
C=S.count('C')
jud = len(re.findall('[A-Z]', S2))
rep=len(S)-2
if S[0]=='A':
    ans=+1
rep=len(S)-2
for i in range(1,rep):
    if S[cou]=='C':
        Ccou=Ccou+1
    cou=cou+1
if Ccou == 1:
    ans=ans+1
if ans ==2 and A==1 and C==1 and jud==2:
    print("AC")
else:
    print("WA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
check = 0
tmp = S[2:-1].split('C')
if (S[0]=='A') and (len(tmp)==2) and S[1].lower()==S[1] and S[-1].lower()==S[-1]:
    for i in range(len(tmp)):
        if tmp[i].lower() == tmp[i]:
            check += 1
    if check == len(tmp):
        print('AC')
    else:
        print('WA')
else:
    print('WA')

Submission status: Accepted

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


def solve(S: str):
    bAC = True

    if S[0] != "A":
        bAC = False

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

    if not S.replace("A","").replace("C","").islower():
        bAC = False

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

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s  = input()
f = True
if s[0] != "A":
    f = False
c = 0
for i in range(2, len(s) - 1):
    if s[i] == "C":
        c += 1
if c != 1:
    f=False
ss = s[1:].replace("C", "")
for i in range(len(ss)):
    if ss[i] < "a" or ss[i] > "z":
        f = False
if f:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
from string import ascii_lowercase
S = input()
if not S[0] is 'A' or not 'C' in S[2:-1]:
    print('WA'),exit()
for i in range(1,len(S)):
    if i == S.index('C'):
        continue
    if not S[i] in ascii_lowercase:
        print('WA'),exit()
print('AC')
# S[2:-1] in 'C'
# S.remove('A'),S.remove('C')
# S is all lower

Submission status: Accepted

Solution code:
from string import ascii_lowercase
S = input()
try:
    if not S[0] is 'A' or not 'C' in S[2:-1]:
        raise RuntimeError
    for i in range(1,len(S)):
        if i == S.index('C'):
            continue
        if not S[i] in ascii_lowercase:
            raise RuntimeError
    print('AC')
except:
    print('WA')
# S[2:-1] in 'C'
# S.remove('A'),S.remove('C')
# S is all lower

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    s = input()
    ok = False
    if s[0] == 'A':
        cnt_C = 0
        for i in s[2:-1]:
            if i=='C':
                cnt_C += 1
        if cnt_C == 1:
            cnt_up = 0
            for i in s:
                if i != i.lower():
                    cnt_up+= 1
            
            if cnt_up == 2:
                ok = True
    
    if ok:
        print('AC')
    else:
        print('WA')


solve()

Submission status: Accepted

Solution code:
import sys
S = str(input())
#print (S)

flag = True

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

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

a = 0
c = 0
for i in S:
    if i == 'A':
        a += 1
    if i == 'C':
        c += 1
    if a >= 2 or c >= 2:
        flag = False
    if i != 'A' and i != 'C':
        if i != i.lower():
            flag = False

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

Submission status: Accepted

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

print(ans)

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:
s = input()

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

Submission status: Accepted

Solution code:
S = input()


def judge(s):
    if s[0] != 'A':
        return 'WA'

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

    t = s.find('C')
    s[1:t]

    return 'AC' if s[1:t].islower() and s[t+1:].islower() else 'WA'


print(judge(S))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
flg = 0
if s[0]!="A":
    print("WA")
elif s[2:-1].count("C") !=1:
    print("WA")
else:
    index = s.find("C")
    all_ind = [i for i in range(1,len(s))]
    all_ind.remove(index)
    for i in all_ind:
        if s[i].isupper():
            flg = 1
            print("WA")
            break
    if flg==0:
        print("AC")

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
def judge(s):
    n=len(s)
    if s[0]!="A":
        return False
    if s[2:n-1].count("C")!=1:
        return False
    ss=s[1:].replace("C","c")
    if ss.islower():
        return True
    return False


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

Submission status: Accepted

Solution code:
from sys import stdin
import re

S = stdin.readline().rstrip()

pattern1 = r"^A([a-z])C([a-z]{1,7})$"
pattern2 = r'^A([a-z]){2}C([a-z]{1,6})$'
pattern3 = r'^A([a-z]){3}C([a-z]{1,5})$'
pattern4 = r'^A([a-z]){4}C([a-z]{1,4})$'
pattern5 = r'^A([a-z]){5}C([a-z]{1,3})$'
pattern6 = r'^A([a-z]){6}C([a-z]{1,2})$'
pattern7 = r'^A([a-z]){7}C([a-z]{1})$'

if (re.match(pattern1, S)) or (re.match(pattern2, S)) or (re.match(pattern3, S)) or (re.match(pattern4, S)) \
        or (re.match(pattern5, S)) or (re.match(pattern6, S)) or (re.match(pattern7, S)):
    print('AC')
else:
    print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import re

s = input()
check = len(s)
if ('A' in s[0]) and ('C' in s[2:len(s)-1]):
    if s.count('C') == 1:
        next_s = s.replace('C', '', 1)
        if next_s[1:len(next_s)].islower():
            print('AC')
            sys.exit()
print('WA')

Submission status: Accepted

Solution code:
S = input()
lead = S[0]
sub = S[2:-1]
C = sub.count('C')
if lead == 'A' and C == 1:
  for x in range(1,len(S)):
    if S[x].islower() or S[x] == 'C':
      pass
    else:
      print('WA')
      exit()
  print('AC')
else:
  print('WA')

Submission status: Accepted

Solution code:
x=input()
import sys

if (x[0:1]=='A') :
    pass
else:
    print('WA')
    sys.exit()

if 'C' in x[2:len(x)-1]:
    pass
else:
    print('WA')
    sys.exit()

z=x[2:len(x)-1]
    
if z.count('C')==1:
    pass
else:
    print('WA')
    sys.exit()

y=x.replace('C','c')
y=y.replace('A','a')


if str.islower(y):
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
input_a = input()
if input_a[0] != 'A':
    print("WA")
elif input_a.count('C')==0:
    print("WA")
elif input_a.count('C')>1:
    print("WA")
elif input_a.index('C') <=1:
    print("WA")
elif input_a.index('C') ==len(input_a)-1:
    print('WA')
elif input_a.count('C') ==1:
    if input_a.replace('A','a').replace('C','c').islower():
        print('AC')
    else:
        print('WA')

Submission status: Accepted

Solution code:
input_a = input()
if input_a[0] != 'A':
    print("WA")
elif input_a.count('C')==0:
    print("WA")
elif input_a.count('C')>1:
    print("WA")
elif input_a.index('C') <=1:
    print("WA")
elif input_a.index('C') ==len(input_a)-1:
    print('WA')
elif input_a.count('C') ==1:
    if input_a.replace('A','a').replace('C','c').islower():
        print('AC')
    else:
        print('WA')

Submission status: Accepted

Solution code:
s = input()

noAC = s.replace('A', '').replace('C', '', 1)
content = s[2:len(s)-1]

if s[0] != 'A' or (not('C' in content)) or (not noAC.islower()):
  print('WA')
else:
  print('AC')

Submission status: Accepted

Solution code:
s = list(input())
c = 0
if s[0] != "A":
    print("WA")
else:
    for i in s[2:-1]:
        if i == "C":
            c += 1
            b = i
    if c == 1:
        s.remove(s[0])
        s.remove(b)
        if "".join(s).islower():
            print("AC")
        else:
            print("WA")
    else:
        print("WA")

Submission status: Accepted

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

else:print("WA")

Submission status: Accepted

Solution code:
s=list(input())
if s[0]!='A':
    print('WA')
else:
    if s.count('C')!=1:
        print('WA')
    else:
        if s.index('C')<2 or s.index('C')>len(s)-2:
            print('WA')
        else:
            s.remove('A')
            s.remove('C')
            count=0
            for i in range(len(s)):
                if str.islower(s[i]):
                    count+=1
            if count==len(s):
                print('AC')
            else:
                print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
if s[0] != 'A':
    print('WA')
    exit()
a = ord(s[1])
if not ord('a') <= a <= ord('z'):
    print('WA')
    exit()
a = ord(s[-1])
if not ord('a') <= a <= ord('z'):
    print('WA')
    exit()
c,d = 0,0
for i in s[2:]:
    if i == 'C':
        c += 1
    elif ord('a') <= ord(i) <= ord('z'):
        d += 1
    else:
        print('WA')
        exit()
if c != 1:
    print('WA')
    exit()
if c + d != len(s) - 2:
    print('WA')
    exit()
print('AC')

Submission status: Accepted

Solution code:
import re

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

Submission status: Accepted

Solution code:
S = input()
ans = True

if S[0] != 'A':
    ans = False
elif S[2:-1].count('C') != 1:
    ans = False
elif not (S[1] + S[2:-1].replace('C', '') + S[-1]).islower():
    ans = False
print('AC' if ans else 'WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

ans = True

if s[0] != 'A':
  ans = False
  
cnt = 0
for i in range(2, len(s) - 1):
  if s[i] == 'C':
    cnt += 1
    
if cnt != 1:
  ans = False
  
cnt = 0
for c in s:
  if c.isupper():
    cnt += 1
    
if cnt != 2:
  ans = False
  
if ans:
  print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
import string
S = input()
ans = [False,False,False]
if S[0] == 'A':
    ans[0] = True
if 'C' in S[2:-1]:
    ans[1] = True
if ans[0] == True and ans[1] == True and list(S).count('C') == 1:
    x = list(S)
    del x[0]
    x.remove('C')
    for i in range(len(x)):
        if x[i] not in list(string.ascii_lowercase):
            break
        if i == len(x) -1:
            ans[2] = True
if ans[0] and ans[1] and ans[2]:
    print('AC')
else:
    print('WA')

Submission status: Accepted

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


def solve(S: str):
    ret = 'AC'
    if S[0] != 'A':
        ret = 'WA'
    else:
        count = 0
        for i, c in enumerate(S[1:]):
            if not c.islower():
                if count < 1 and c == 'C' and i >= 1 and i <= len(S) - 3:
                    count += 1
                else:
                    ret = 'WA'
                    break
        if count < 1:
            ret = 'WA'
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#ABC 104 B
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")
    else:
        print("WA")
else:
    print("WA")

Submission status: Accepted

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