       IDENTIFICATION DIVISION.
       PROGRAM-ID. ABC042-B.
       DATA DIVISION.
       FILE SECTION.
       WORKING-STORAGE SECTION.
       77 INSTR PIC X(100).
       77 N PIC 9(3).
       77 L PIC 9(3).
       77 I PIC 9(3).
       01 STR.
        03 STRARR OCCURS 1 TO 100 TIMES DEPENDING ON N.
         05 STRDATA PIC X(100).
       77 ANS PIC X(10000).

       PROCEDURE DIVISION.
       MAIN-PROCEDURE.
            ACCEPT INSTR FROM SYSIN.
            UNSTRING INSTR DELIMITED " "
             INTO N L.
            PERFORM VARYING I FROM 1 BY 1
             UNTIL N < I
               ACCEPT INSTR FROM SYSIN
               MOVE INSTR TO STRARR(I)
            END-PERFORM.
            SORT STRARR ASCENDING STRDATA.
            PERFORM VARYING I FROM 1 BY 1
             UNTIL N < I
               STRING ANS STRARR(I) DELIMITED BY SPACE
                INTO ANS
            END-PERFORM.
            DISPLAY ANS.
            STOP RUN.
       END PROGRAM ABC042-B.
