Language: C++

IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_098_B.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 N      PIC 9(3).
    01 S      PIC X(100).

    01 chr    PIC X(1)   VALUE SPACE.
    01 str    PIC X(100) VALUE SPACE.

    01 i      PIC 9(2).
    01 j      PIC 9(2).
    01 k      PIC 9(2).

    01 flg    PIC 9(1)   VALUE 0.
    01 cur    PIC 9(3).

    01 len    PIC 9(1)   VALUE 1.
    01 cnt    PIC 9(2)   VALUE 0.
    01 cntmax PIC 9(2)   VALUE 0.

    01 ans    PIC Z9.

    01 X1.
        03 XNUM PIC 9(2) VALUE 0.
        03 X11 OCCURS 26.
            05 X PIC X(1).

    01 Y1.
        03 YNUM PIC 9(2) VALUE 0.
        03 Y11 OCCURS 26.
            05 Y PIC X(1).

PROCEDURE                        DIVISION.
MAIN.
    ACCEPT N.
    ACCEPT S.

    PERFORM VARYING i FROM 1 BY 1 UNTIL N < i
        MOVE S(i : len) TO chr;

        MOVE 0 TO flg;

        PERFORM VARYING j FROM 1 BY 1 UNTIL XNUM < j
            IF X(j) = chr THEN
                MOVE 1 TO flg
            END-IF;
        END-PERFORM;

        IF flg = 0 THEN
           ADD 1 TO XNUM;
           MOVE chr TO X(XNUM);
        END-IF;

        INITIALIZE Y1;

        COMPUTE cur = i + 1;

        MOVE S(cur : N - i) TO str;

        PERFORM VARYING j FROM 1 BY 1 UNTIL N - 1 < j
            MOVE str(j : len) TO chr;

            MOVE 0 TO flg;

            PERFORM VARYING k FROM 1 BY 1 UNTIL YNUM < k
                IF Y(k) = chr THEN
                    MOVE 1 TO flg
                END-IF;
            END-PERFORM;

            IF flg = 0 THEN
                ADD 1 TO YNUM;
                MOVE chr TO Y(YNUM);
            END-IF;
        END-PERFORM;

        MOVE 0 TO cnt;
        PERFORM VARYING j FROM 1 BY 1 UNTIL XNUM < j

            PERFORM VARYING k FROM 1 BY 1 UNTIL YNUM < k
                IF X(j) = Y(k) THEN
                    ADD 1 TO cnt;
                END-IF;
            END-PERFORM;

        END-PERFORM;

        COMPUTE cntmax = FUNCTION MAX(cntmax, cnt);

    END-PERFORM.

    MOVE cntmax TO ans.
    DISPLAY ans.

    STOP RUN.


Compiler output:
a.cc:1:1: error: 'IDENTIFICATION' does not name a type
    1 | IDENTIFICATION                   DIVISION.
      | ^~~~~~~~~~~~~~
a.cc:43:9: error: 'MOVE' does not name a type
   43 |         MOVE 0 TO flg;
      |         ^~~~
a.cc:45:9: error: 'PERFORM' does not name a type
   45 |         PERFORM VARYING j FROM 1 BY 1 UNTIL XNUM < j
      |         ^~~~~~~
a.cc:49:9: error: 'END' does not name a type
   49 |         END-PERFORM;
      |         ^~~
a.cc:51:9: error: 'IF' does not name a type
   51 |         IF flg = 0 THEN
      |         ^~
a.cc:53:12: error: 'MOVE' does not name a type
   53 |            MOVE chr TO X(XNUM);
      |            ^~~~
a.cc:54:9: error: 'END' does not name a type
   54 |         END-IF;
      |         ^~~
a.cc:56:9: error: 'INITIALIZE' does not name a type
   56 |         INITIALIZE Y1;
      |         ^~~~~~~~~~
a.cc:58:9: error: 'COMPUTE' does not name a type
   58 |         COMPUTE cur = i + 1;
      |         ^~~~~~~
a.cc:60:9: error: 'MOVE' does not name a type
   60 |         MOVE S(cur : N - i) TO str;
      |         ^~~~
a.cc:62:9: error: 'PERFORM' does not name a type
   62 |         PERFORM VARYING j FROM 1 BY 1 UNTIL N - 1 < j
      |         ^~~~~~~
a.cc:65:13: error: 'MOVE' does not name a type
   65 |             MOVE 0 TO flg;
      |             ^~~~
a.cc:67:13: error: 'PERFORM' does not name a type
   67 |             PERFORM VARYING k FROM 1 BY 1 UNTIL YNUM < k
      |             ^~~~~~~
a.cc:71:13: error: 'END' does not name a type
   71 |             END-PERFORM;
      |             ^~~
a.cc:73:13: error: 'IF' does not name a type
   73 |             IF flg = 0 THEN
      |             ^~
a.cc:75:17: error: 'MOVE' does not name a type
   75 |                 MOVE chr TO Y(YNUM);
      |                 ^~~~
a.cc:76:13: error: 'END' does not name a type
   76 |             END-IF;
      |             ^~~
a.cc:77:9: error: 'END' does not name a type
   77 |         END-PERFORM;
      |         ^~~
a.cc:79:9: error: 'MOVE' does not name a type
   79 |         MOVE 0 TO cnt;
      |         ^~~~
a.cc:80:9: error: 'PERFORM' does not name a type
   80 |         PERFORM VARYING j FROM 1 BY 1 UNTIL XNUM < j
      |         ^~~~~~~
a.cc:85:17: error: 'END' does not name a type
   85 |                 END-IF;
      |                 ^~~
a.cc:86:13: error: 'END' does not name a type
   86 |             END-PERFORM;
      |             ^~~
a.cc:88:9: error: 'END' does not name a type
   88 |         END-PERFORM;
      |         ^~~
a.cc:90:9: error: 'COMPUTE' does not name a type
   90 |         COMPUTE cntmax = FUNCTION MAX(cntmax, cnt);
      |         ^~~~~~~
a.cc:92:5: error: 'END' does not name a type
   92 |     END-PERFORM.
      |     ^~~