CHARACTER(20) S
INTEGER A,B
READ*,S
A=SCAN(S,"C")
B=SCAN(S,"C",.TRUE.)
IF (S(1:1)/="A".or.A<=2.or.A/=B.or.B==LEN_TRIM(S))THEN
  PRINT"(A)","WA"
  STOP
ENDIF
S(1:1)="a"
S(A:A)="c"
DO I=1,LEN_TRIM(S)
  IF(ICHAR(S(I:I))<ICHAR("a"))THEN
      PRINT"(A)","WA"
  STOP
  ENDIF
END DO
PRINT"(A)","AC"
END 