Submission #2957432

Source Code Expand

Copy
from collections import Counter
def capital(c):
  return c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def solve(s):
  if s[0] != 'A':
    return False

  if capital(s[1]) or capital(s[-1]):
    return False

  st = Counter(s[2:-1])
  if st['C'] != 1:
    return False
  for c in s[2:-1]:
    if c == 'C': continue
    if capital(c): return False
  return True

s=raw_input()
if solve(s):
  print 'AC'
else:
  print 'WA'

Submission Info

Submission Time
Task B - AcCepted
User naoya_t
Language Python2 (2.7.6)
Score 200
Code Size 434 Byte
Status
Exec Time 14 ms
Memory 2812 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 a01, a02, a03, a04, a05
All 200 / 200 a01, a02, a03, a04, a05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16
Case Name Status Exec Time Memory
a01 14 ms 2812 KB
a02 11 ms 2808 KB
a03 11 ms 2808 KB
a04 11 ms 2808 KB
a05 11 ms 2808 KB
b06 11 ms 2808 KB
b07 11 ms 2808 KB
b08 11 ms 2808 KB
b09 11 ms 2808 KB
b10 11 ms 2808 KB
b11 11 ms 2808 KB
b12 11 ms 2808 KB
b13 11 ms 2808 KB
b14 11 ms 2808 KB
b15 11 ms 2808 KB
b16 11 ms 2808 KB