IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM_ID.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 N              PIC 9(10).
01 S              PIC X(50).
01 cnt            PIC 9(10).
01 ans            PIC Z(9)9.

PROCEDURE DIVISION.
  ACCEPT N.
  ACCEPT S.
  INSPECT S TALLYING cnt FOR ALL "ABC".
  MOVE cnt TO ans.
  DISPLAY ans.
  STOP RUN.
