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