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:
S = input()
Flag = False
if (S[0]=='A') and S[2:len(S)-1].count('C')==1:
    ReS = S.replace('C','')[1:]
    if ReS.islower():
        Flag = True
if Flag:
    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"
else:
  S.pop(S[2:-1].index("C") + 2)

if not "".join(S[1:]).islower():
  ans = "WA"

print(ans)

Submission status: Accepted

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

if 'C' not in S[2:-1]:
  print('WA')
  exit()

s=list(S)
s.remove('A')
s.remove('C')

for x in s:
  if x not in 'abcdefghijklmnopqrstuvwxyz':
    print('WA')
    exit()

print('AC')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input();print('WAAC'['A'==s[0] and s[2:-1].count('C')==1 and (s[1:2]+s[-1:]).islower()::2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input();print('WAAC'['A'==s[0] and 'C'in s[2:-1] and s.count('C')==1 and s.count('A')==1  and s.replace('A','').replace('C','').islower()::2])

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

S = input()

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

Submission status: Accepted

Solution code:


S=str(input())
temp=0
j=0
if S[0]!='A':
    print('WA')
    exit()
for i in range(2,len(S)-1):
    if S[i]=='C':
        temp+=1
        j=i
if temp!=1:
    print('WA')
    exit()
for i in range(len(S)):
    if i!=0 and i!=j:
        if S[i].isupper():
            print('WA')
            exit()
print('AC') 
exit()

Submission status: Accepted

Solution code:
S = input()


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())

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

S.pop(0)

res = True
c = False

for i in range(len(S)):
    if i == 0 or i == len(S) - 1:
        if not S[i].islower():
            res = False
    
    else:
        if S[i] == "C":
            if not c:
                c = True
            else:
                res = False

        else:
            if not S[i].islower():
                res = False

if res and c:
    print("AC")
else:
    print("WA")

Submission status: Accepted

Solution code:
s=input()
n=len(s)
if s[0]!="A":
    print("WA")
    exit()
if all(s[i]!="C" for i in range(2,n-1)):
    print("WA")
    exit()
f=0
for i in range(n):
    if s[i]==s[i].upper():
        f+=1
print("AC" if f==2 else "WA")

Submission status: Accepted

Solution code:
S=input()
if S[0]=="A":
  c=0
  d=0
  for x in range(2,len(S)-1):
    if S[x].islower():
      d+=1
    if S[x]=="C":
      c+=1
  if c==1 and d==len(S)-4 and S[1].islower() and S[len(S)-1].islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
x = 0
if S[0] == 'A':
    if S[1] == 'C' or S[-1] == 'C':
        print('WA')
    else:
        if S.count('C') == 1:
            S.replace('A', '')
            S.replace('C', '')
            N = len(S)
            for i in range(N):
                if 97 <= ord(S[i]) <= 122:
                    x += 1
            if x == N - 2:
                print('AC')
            else:
                print('WA')
        else:
            print('WA')
else:
    print('WA')

Submission status: Accepted

Solution code:
s = input()

n = list(s)

check = False
isok = True

if n[0] == 'A':
    check = True

count = 0

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

for i in range(len(n)):
    p = int(ord(n[i]))
    if p == 65 or p == 67 or p > 96:
        continue
    else:
        isok = False

if check and count == 1 and isok:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
S = input()
if S[0] == "A":
  count = 0
  for i in S[2:-1]:
    if i == "C":
      count += 1
  if count == 1:
    c = 0
    for i in S:
      if i.isupper():
        c += 1
    if c == 2:
      print("AC")
      exit()
print("WA")

Submission status: Accepted

Solution code:
def main():
    S = str(input())
    cnt = 0
    if S[0] == 'A':
        for i in range(2, len(S)-1):
            if S[i] == 'C':
                cnt += 1
        if cnt == 1:
            for i in range(1, len(S)):
                if S[i] == 'C':
                    continue
                elif S[i].islower():
                    continue
                else:
                    print('WA')
                    return
        else:
            print('WA')
            return
    else:
        print('WA')
        return
    print('AC')
    
main()

Submission status: Accepted

Solution code:
s = input()

ans = False
if s.startswith('A'):
    if s.count('C') == 1:
        if 2 <= s.find('C') <= len(s) - 2:
            s = s.replace('A', 'a', 1)
            s = s.replace('C', 'c', 1)
            if s.lower() == s:
                ans = True
print('AC' if ans else 'WA')

Submission status: Accepted

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

s = str(input())

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


num_C = 0
for i in s[2:-1]:
    if i == "C":
        num_C += 1

for i in s[1:]:
    if i != "C" and i.isupper():
        flag = 0

if num_C != 1:
    flag = 0


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

Submission status: Accepted

Solution code:
S=str(input())
cnt=0
T = S.replace("C","").replace("A","")
for i in range(2,len(S)-1):
    if S[i] =='C':cnt+=1
if cnt==1 and S[0]=='A' and T.islower():
    print("AC")
    exit()
print("WA")

Submission status: Accepted

Solution code:
S=str(input())
cnt=0
for i in range(2,len(S)-1):
    if S[i] =='C':
        cnt+=1
if cnt==1:
    if S[0]=='A':
        T = S.replace("C","").replace("A","")
        if T.islower():
            print("AC")
            exit()
print("WA")

Submission status: Accepted

Solution code:
S=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()

for i in range(1,len(S)):
  if S[i] != 'C' and (ord(S[i])<97 or ord(S[i])>122):
    print('WA')
    exit()

print('AC')

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
s = input()
counter = 0
for i in range(len(s)):
  if i == 0:
    if s[i] == "A":
      continue
    else:
      print("WA")
      exit()
  else:
    if 2<=i<=len(s)-1:
      if s[1] != s[1].lower():
        print("WA")
        exit()
      if s[i] == "C":
        counter += 1
      else:
        if s[i] != s[i].lower():
          print("WA")
          exit()
    if s[-1] != s[-1].lower():
      print("WA")
      exit()
if counter == 1:
  print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
S = str(input())
N = len(S)

alpha2num = lambda c: ord(c) - ord('a') + 1
#print(alpha2num("a"))
#print(alpha2num("Z"))
p = 0
s = 0
for i in range(N):
  if i == 0:
    if S[i] != "A":
      p = 1
  elif 2 <= i <= N - 2:
    if S[i] == "C":
      s += 1
    else:
      if alpha2num(S[i]) < 0:
        p = 1
  else:
    if alpha2num(S[i]) < 0:
      p = 1 
      

  
  
if (p == 0) and (s == 1):
  print("AC")
else:
  print("WA")

Submission status: Accepted

Solution code:
s = input()

wa = False

if s[0] != 'A':
  wa = True
if s[2:-1].count('C') != 1:
  wa = True

l_s = list(s)
  
if 'A' in l_s:
	del l_s[l_s.index('A')]

if 'C' in l_s:
	del l_s[l_s.index('C')]

for c in l_s:
  if c != c.lower():
    wa = True
    
if wa == True:
  print('WA')
else:
  print('AC')

Submission status: Accepted

Solution code:
s = list(input())
if s[0]=='A':
    s.remove(s[0]);   l = len(s)
    for i in range(l):
        if s[1:l-1].__contains__('C'):
            s.remove('C')
            print('AC' if str(s) == str(s).lower() else 'WA');   break
        else:
            print('WA');   break
else:
    print('WA')

Submission status: Accepted

Solution code:
s=input()
res="AC"
if s[0]!="A":res="WA"
elif s[2:-1].count("C")!=1:res="WA"
else:
    li=list(s)
    li.remove("A")
    li.remove("C")
    for i in li:
        if i!=i.lower():
            res="WA"
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re

print ('AC' if re.match(r'\AA[a-z]+C[a-z]+\Z', input()) else 'WA')

Submission status: Accepted

Solution code:
s = input()

a = -1
c = -1
lower = 0
for i in range(len(s)):
  if s[i] == 'A':
    a = i
  if s[i] == 'C':
    c = i
  if 'a' <= s[i] <= 'z':
    lower += 1

if a == 0 and 2 <= c <= len(s) - 2 and lower == len(s) - 2:
  print('AC')
else:
  print('WA')

Submission status: Accepted

Solution code:
import re

print ('AC' if re.match(r'\AA[a-z](?:[a-z]*C[a-z]*)[a-z]\Z', input()) else 'WA')

Submission status: Accepted

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
s=input()
c=False
if s[0]=="A":
    for i in range(1,len(s)):
        if s[i]!="C" and s[i].isupper():
            print("WA")
            break
        elif s[i]=="C" :
            if c==False and 2<=i<=len(s)-2:
                c=True

            else:
                print("WA")
                break
    else:
      if  c:
        print("AC")
      else:
        print("WA")
else:
  print("WA")

Submission status: Accepted

Solution code:
S = input()
sl = []
ans = 'AC'

for i in S:
    sl.append(i)
if S[0] != 'A':
    ans = 'WA'
if S[2:-1].count('C') != 1:
    ans = 'WA'

if S[1:].replace("C","c",1).islower() == False:
    ans = 'WA'
#print(sl)
print(ans)

Submission status: Accepted

Solution code:
S = str(input())
    
result = False
    
    
if S[0] == 'A':
    
    check = S[2:len(S)-1]
    
    if check.count('C') == 1:
        index = check.find('C') + 2
        
        if S[1:index].islower() and S[index+1:].islower():
            result = True
            
if result:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
# abc104_b.py
# https://atcoder.jp/contests/abc104/tasks/abc104_b

# ★ WA:2
# b12
# b13

# B - AcCepted /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# 文字列 Sが与えられます。S のそれぞれの文字は英大文字または英小文字です。 Sが次の条件すべてを満たすか判定してください。
#     Sの先頭の文字は大文字の A である。
#     Sの先頭から 3 文字目と末尾から 2 文字目の間（両端含む）に大文字の C がちょうど 1個含まれる。
#     以上の A, C を除く Sのすべての文字は小文字である。

# 制約
#     4≤|S|≤10（|S| は文字列 Sの長さ）
#     Sのそれぞれの文字は英大文字または英小文字である。

# 入力
# 入力は以下の形式で標準入力から与えられる。
# S

# 出力
# Sが問題文中の条件すべてを満たすなら AC、そうでなければ WA と出力せよ。

# 入力例 1
# AtCoder

# 出力例 1
# AC

# 1文字目が A、3文字目が C でそれ以外の文字はすべて小文字であり、すべての条件を満たします。

# 入力例 2
# ACoder

# 出力例 2
# WA

# 2文字目が C であってはいけません。

# 入力例 3
# AcycliC

# 出力例 3
# WA

# 最後の文字が C であってもいけません。

# 入力例 4
# AtCoCo

# 出力例 4
# WA

# C を 2個以上含んではいけません。

# 入力例 5
# Atcoder

# 出力例 5
# WA

# C を 1個も含まないのもいけません。


def calculation(lines):
    S = lines[0]
    n_c = 0
    n_l = 0
    for i in range(len(S)):
        if S[i] == 'C':
            n_c += 1
        if S[i] < 'a':
            n_l += 1
    if S[0] != 'A':
        ret = 'WA'
    elif S[1] == 'C':
        ret = 'WA'
    elif S[-1] == 'C':
        ret = 'WA'
    elif n_c != 1:
        ret = 'WA'
    elif n_l != 2:
        # print(n_l)
        ret = 'WA'
    else:
        ret = 'AC'
    return [ret]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['AtCoder']
        lines_export = ['AC']
    if pattern == 2:
        lines_input = ['ACoder']
        lines_export = ['WA']
    if pattern == 3:
        lines_input = ['AcycliC']
        lines_export = ['WA']
    if pattern == 4:
        lines_input = ['AtCoCo']
        lines_export = ['WA']
    if pattern == 5:
        lines_input = ['Atcoder']
        lines_export = ['WA']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

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

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

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

if s[1:].islower():
        print('AC')
else:
        print('WA')

Submission status: Accepted

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

ans = 'AC'
if S[0] != 'A' or 'C' not in S[2:-1]:
    ans = 'WA'

tmp = 0
for i in range(1,N):
    if S[i].isupper():
        tmp += 1

if tmp > 1:
    ans = 'WA'

print(ans)

Submission status: Accepted

Solution code:
S = input()
answer = 'WA'
if S[0] == 'A':
    sKiridashi = S[2:-1]
    if sKiridashi.count('C') == 1:
        cIndex = sKiridashi.find('C') + 2
        otherStr = S[1:cIndex] + S[cIndex+1:]
        if otherStr.islower():
            answer = 'AC'
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter
s = list(input())
n = len(s)
count = Counter(s[2:-1])
lower = [i for i in s if ord('a')<=ord(i)<=ord('z')]

if count.get('C'):
    if count['C']==1 and s[0]=='A' and len(lower)==n-2:
        print('AC')
        exit()
print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
count =0
total =0
if S[0] == 'A':
  count +=1
bbb = S[2:-1]
if bbb.count('C') == 1:
  count +=1
for i in S:
  if i.isupper():
    total +=1
if total ==2:
  count +=1
if count == 3:
  print('AC')
else:
  print('WA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

ans = "WA"

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

print(ans)

Submission status: Accepted

Solution code:
S = input()

# S = 'AaCa'
# print( S[1], S[-1], S[3:-2])

b = True
b = b and (S[0]=='A')
b = b and ( S[2:-1].count('C')==1 )

b = b and ( 'a' <= S[1] <= 'z')
b = b and ( 'a' <= S[-1] <= 'z')

for c in S[3:]:
  b = b and ( ('a' <= c <= 'z') or (c=='C') )

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

Submission status: Accepted

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

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

f = False
for i in range(1, len(s)):
    if s[i] == 'C':
        if i < 2 or i >= len(s) - 1:
            print('WA')
            exit(0)
        if f:
            print('WA')
            exit(0)
        f = True
    elif not str.islower(s[i]):
        print('WA')
        exit(0)

if f:
    print('AC')
else:
    print("WA")

Submission status: Accepted

Solution code:
S = input()

ans = "WA"

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

print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = readline().decode().rstrip()

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

Submission status: Accepted

Solution code:
s = input()
ans = 'AC'
if s[0] != 'A':
    ans = 'WA'
if not('C' in s[2:-1]):
    ans = 'WA'
s = s.replace('A','')
s = s.replace('C','',1)
for i in s:
    if ord(i) < ord('a') or ord(i) > ord('z'):
        ans = 'WA'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
if ord(S[0]) != 65:
    print("WA")
    exit()
num = 0
for i in range(2,len(S)-1):
    if S[i] == "C":
        num = i
if not num:
    print("WA")
    exit()
else:
    for j in range(1,len(S)):
        if j != num:
            if 97 <= ord(S[j]) <= 122:
                continue
            else:
                print("WA")
                exit()
print("AC")

Submission status: Accepted

Solution code:
S = list(input())

if S[0] == 'A':
  isC = 0
  for i in S[2:len(S)-1]:
    if i == 'C':
      isC += 1
  else:
    if isC == 1:
      for i in range(len(S)):
        if S[i] == 'A' or S[i] =='C' or S[i].islower():
          pass
        else:
          print('WA')
          break
      else:
        print('AC')
    else:
      print('WA')
else:
  print('WA')

Submission status: Accepted

Solution code:
S = input()
if S[0] == "A":
    S_cpy = S.lstrip("A")
else:
    print("WA")
    exit()

if S[2:-1].count("C") == 1:
    S_cpy = S_cpy.replace("C", "")
else: 
    print("WA")
    exit()

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

Submission status: Accepted

Solution code:
import sys
s = input()

if s[0] != 'A':
    print("WA") 
    sys.exit()
if s[2:-1].count("C")!=1:
    print("WA")
    sys.exit()

# Aが頭にあってCは一つしかない
for i,c in enumerate(s):
    if i != 0 and i!=s[2:-1].index("C")+2:
        if ord(c) <= 90:
            print("WA")
            sys.exit()

print("AC")

Submission status: Accepted

Solution code:
s = input()
ans = True

if s[0] != 'A':
    ans = False
    # print(f's[0]:{s[0]}')

index = -1
between_bigin_3_and_end_2 = s[2:-1]
count = between_bigin_3_and_end_2.count('C')
if count == 1:
    index = s.index('C')
    # print(index)
else:
    ans = False
    # print(f'between_bigin_3_and_end_2:{between_bigin_3_and_end_2}')
    # print(f'count:{count}')

    
for i in range(len(s)):
    if i == 0:
        continue
    if i == index:
        continue
    if not s[i].islower():
        ans = False


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

Submission status: Accepted

Solution code:
S = list(input()) #１文字ずつ
N = len(S)
al=[chr(ord('a') + i) for i in range(26)]
# print('al:',al)
 
flag=0
if S[0]!='A':
    #print('A')
    flag=1
 
else:
    count=0
    for i in range(2,N-1):
        if S[i]=='C':
            count+=1
 
    # print('count:',count)
    if count==1:
        for i in range(N):
            if S[i]!='A' and S[i]!='C':
                if S[i] not in al:
                    flag=1
 
    else:
        flag=1
 
if flag==0:
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
S = input()

ans = "AC"

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

if S.count("C") != 1:
    ans = "WA"

if not ("C" in S[2:-1]):
    ans = "WA"

for i in range(len(S)):
    if S[i].isupper():
        if S[i] == "A" or S[i] == "C":
            pass
        else:
            ans = "WA"

print(ans)

Submission status: Accepted

Solution code:
s = open(0).read().rstrip()

import re

if len(s)>3 and re.fullmatch(r'A[a-z]+C[a-z]+',s):
    print('AC')
elif len(s) == 3 and re.fullmatch(r'A[a-z]?C[a-z]?',s):
    print('AC')
else:
    print('WA')

Submission status: Accepted

Solution code:
import collections
r = raw_input()
print 'AC' if ( r[0] == 'A' and  collections.Counter(r[2:-1])['C'] == 1 and  all([l in set(['A', 'C']) or l.lower() ==l for l in r ])) else 'WA'

Submission status: Accepted

Solution code:
"""
1. The initial character of S is an uppercase A.
2. There is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).
3. All letters except the A and C mentioned above are lowercase.
"""
import collections
def f(r): return r[0] == 'A' and  collections.Counter(r[2:-1])['C'] == 1 and  all([l in set(['A', 'C']) or l.lower() ==l for l in r ])

print 'AC' if f(raw_input()) else 'WA'

Submission status: Accepted

Solution code:
"""
1. The initial character of S is an uppercase A.
2. There is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).
3. All letters except the A and C mentioned above are lowercase.
"""
import collections
def a(r): return r[0] == 'A'
def b(r): return collections.Counter(r[2:-1])['C'] == 1
def c(r): return all([l in set(['A', 'C']) or l.lower() ==l for l in r ])
def f(r):  return a(r) and b(r) and c(r)

print 'AC' if f(raw_input()) else 'WA'

Submission status: Accepted

Solution code:
s = list(input())
flag = 1
if s[0] == "A" :
    if s[2:-1].count("C") == 1 :
        for i in range(1,len(s)) :
            if i != s[2:-1].index("C") + 2 :
                if s[i] != s[i].lower() :
                    flag = 0
                    break
    else :
        flag = 0
else :
    flag = 0

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

Submission status: Accepted

Solution code:
def main():
    S = input().rstrip()
    if S[0] != "A":
        print("WA")
        exit()
    if S[2:-1].count("C") != 1:
        print("WA")
        exit()
    chars = [chr(i) for i in range(97, 97+26)]
    for s in S[1:]:
        if s == "C":
            continue
        elif s not in chars:
            print("WA")
            exit()
    print("AC")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    s=input()
    if s[0] == "A":
        if (s[2:-1:]).count("C") == 1:
            for i in s[1:]:
                c = False
                if i == "C" and not c:
                    c = True
                    continue
                elif i == "C" and c:
                    break
                elif i.islower():
                    continue
                else:
                    break
            else:
                print("AC")
                return
    print("WA")
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def solve():
    S = input()
    cnt = 0
    if S[0] != 'A':
        print('WA')
        exit()
    for i in range(1, len(S)):
        if S[i].isupper():
            if i == 1 or i == len(S) - 1 or S[i] != 'C':
                print('WA')
                exit()
            cnt += 1
    if cnt != 1:
        print('WA')
        exit()
    print('AC')






if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import math
def main():
  s = input()
  flg=0
  if s[0]=='A':
    if s[2:len(s)-1].count('C')==1:
      s=s.replace('C','c')
      if s[1:].islower():
        print("AC")
        flg=1
  if flg==0:
    print("WA")
main()

Submission status: Accepted

Solution code:
import sys
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

S = LS2()

if not (S.count('C') == 1 and S[0] == 'A' and S[1] != 'C' and S[-1] != 'C'):
    print('WA')
    exit()
else:
    for i in range(1,len(S)):
        if not (S[i] == 'C' or S[i].islower()):
            print('WA')
            exit()
print('AC')

Submission status: Accepted

Solution code:
import sys
s = input()

answer = True
if s[0] != "A":
  answer = False

if s[2:len(s)-1].count("C") != 1:
  answer = False
  
for i in range(len(s)):
  if s[i] != "A" and s[i] != "C":
    if ord(s[i]) < 97  or  122 < ord(s[i]):
      answer = False

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

Submission status: Accepted

Solution code:
s=input()
n=len(s)
f=True
if s[0]!='A':
    f=False
if s[2:n-1].count('C')!=1:
    f=False
for ss in s:
    if ss!='A' and ss!='C' and ss.isupper():
        f=False
print('AC' if f else 'WA')

Submission status: Accepted

Solution code:
S = input()
N = len(S)
f = True
if S[0] != 'A':
    f = False
if S[2:N-1].count('C') != 1:
    f = False
for s in S:
    if s != 'A' and s != 'C' and s.isupper():
        f = False
print('AC' if f else 'WA')

Submission status: Accepted

Solution code:
S = input()
ans = 0

if S[0]=="A":
  S = S[1:]
  if 1<=S.find("C")<=len(S)-2:
    S = S[:S.find("C")]+S[S.find("C")+1:]
    for s in S:
      if 97<=ord(s)<=122:
        ans+=1
    if ans == len(S):
      print("AC")
      exit()
        
print("WA")

Submission status: Accepted

Solution code:
S = list(input())
l = [chr(i) for i in range(65, 65+26)]

flag = True
count = 0
for i in range(len(S)):
    if i == 0:
        if S[i] != 'A':
            flag = False
            break
    if i == 1:
        if S[i] in l:
            flag = False
            break
    if 2 <= i <= len(S) - 2:
        if S[i] == 'C':
            count += 1
        elif S[i] in l:
            flag = False
            break
    if i == len(S) - 1:
        if S[i] in l:
            flag = False
            break
if not count == 1:
    flag = False

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

Submission status: Accepted

Solution code:
import string

s = list(input())
flag = True
if s[0] != "A":
    flag = False
count = 0
for i in range(1, len(s)):
    if s[i] in string.ascii_uppercase:
        if i == 1 or i == len(s) - 1 or s[i] != "C":
            flag = False
        count += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

def solve(s):
    return s[0] == "A" and s.count("C",2,-1) == 1 and s[1:].replace("C", "").islower()


def main():
    S = input()
    print("AC" if solve(S) else "WA")
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = list(input())

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

if S[2:len(S)-1].count("C")!=1:
    print("WA")
    exit()

count = 0
for i in range(0,len(S),1):
    if ord(S[i])<95:
        count+=1

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

print("AC")

Submission status: Accepted

Solution code:
s = input()

cond = True

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

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

s = s.replace("C", "")
if not s[1:].islower():
    cond = False

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
if s[0]=="A" and s[2:len(s)-1].count("C")==1:
    s[0]="a"
    s[s.index("C")]="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:
    for i in range(len(s)):
        if not (i == 0 or i == s[2:-1].index('C')+2):
            if not s[i].islower():
                print('WA')
                exit()
    print('AC')
    exit()
print('WA')

Submission status: Accepted

Solution code:
s = input()
n = len(s)
ans = 1
if s[0] != "A":
    ans *= 0
if not (97 <= ord(s[1]) <= 122):
    ans *= 0
if not (97 <= ord(s[-1]) <= 122):
    ans *= 0

check = 0
for i in range(1, n - 1):
    if s[i] == "C":
        check += 1
print(["WA", "AC"][ans & (check == 1)])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s=input()
if s[0] == 'A' and 1 < s.find('C') < len(s) - 1 and (s[1:s.index('C')]+s[s.index('C')+1:]).islower():
    print("AC")
else:
    print('WA')