program accepted
  implicit none
  character(10) :: s
  integer :: n, i
  logical :: ac = .false., ok = .false.
  read(*,*) s
  if (s(1:1) == 'A') then
    n = len_trim(s)
    do i = 2, n
      if (s(i:i) == 'C') then
        if (ok) goto 100
        if (i < 3 .or. i > n-1) goto 100
        ok = .true.
      end if
      if ('a' <= s(i:i) .and. s(i:i) <= 'z') cycle
    end do
    ac = ok
  end if
  100 write(*,'(a)') merge("AC","WA",ac)
end program accepted