IDENTIFICATION DIVISION.
PROGRAM-ID. A-Task.
 
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP      PIC X(100).
01 TSK-COST.
   03 T-C   PIC 9(3) OCCURS 3 DEPENDING ON CNT.
01 CNT      PIC 9(1) VALUE 3.

01 OUT-COST PIC ZZ9.
 
PROCEDURE DIVISION.
MAIN-001.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ALL ' '
      INTO T-C(1) T-C(2) T-C(3).
 
  SORT T-C DESCENDING KEY T-C.
  DISPLAY TSK-COST.
  COMPUTE OUT-COST = T-C(1) - T-C(3).
  DISPLAY OUT-COST.
 
MAIN-EXIT.
  STOP RUN.