IDENTIFICATION DIVISION.
PROGRAM-ID. A-Eating.
 
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP.
   03 IN-S  PIC X(1) OCCURS 4. 
01 C-P      PIC 9(1). 
01 C-M      PIC 9(1).
01 I        PIC 9(1).
01 OUT-N    PIC -9.
 
PROCEDURE DIVISION.
MAIN-001.
  ACCEPT INP.

  MOVE 0    TO C-P C-M.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > 4
    IF (IN-S(I) = '+')
      ADD 1 TO C-P
    ELSE
      ADD 1 TO C-M
    END-IF
  END-PERFORM.

  COMPUTE OUT-N = C-P - C-M.
  DISPLAY OUT-N.
 
MAIN-EXIT.
  STOP RUN.