import Data.Char

main = interact $ pureMain

pureMain :: String -> String
pureMain s = if f s then "AC\n" else "WA\n"

f :: String -> Bool
f ('A':a:as) = if a == 'C' || isUpper a then False else g as
f _ = False

g :: String -> Bool
g "C" = False
g ('C':as) = h as
g (x:as) = if isUpper x then False else g as
g [] = False

h :: String -> Bool
h (x:as) = if isUpper x then False else h as
h [] = True
