IDENTIFICATION DIVISION.
PROGRAM-ID. 122B.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 S   PIC X(11).
01 I   PIC 9(2).
01 CNT PIC 9(2).
01 MAX PIC 9(2).
01 OUT PIC Z9.
01 C   PIC X(1).
   88  ATC VALUE 'A' 'C' 'G' 'T'.
*>
PROCEDURE DIVISION.
  ACCEPT S.
  MOVE 0 TO CNT MAX.
  PERFORM VARYING I FROM 1 BY 1 
    UNTIL (I > 10) OR (S(I:1) = ' ')
    MOVE S(I:1) TO C
    IF ATC
      ADD 1 TO CNT
      IF (CNT > MAX)
        MOVE CNT TO MAX
      END-IF
    ELSE
      MOVE 0 TO CNT
    END-IF 
  END-PERFORM.  
*>
  MOVE MAX TO OUT.
  DISPLAY FUNCTION TRIM(OUT).
*>
  STOP RUN.
