IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_081_A.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 i      PIC 9(1).
    01 INP    PIC X(3).
    01 cnt    PIC 9(1).
    01 ZS     PIC Z(1)9.
    01 ans    PIC X(1).
    01 DUMMY  PIC X(1).
PROCEDURE                        DIVISION.
MAIN.
    ACCEPT INP.

    MOVE 0 TO cnt.

    PERFORM VARYING i FROM 1 BY 1 UNTIL 3 < i
        IF INP(i:1) = '1' THEN
            ADD 1 TO cnt
        END-IF
    END-PERFORM.

    MOVE cnt TO ZS

    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.
