 IDENTIFICATION DIVISION.
 PROGRAM-ID. TEST103.

 DATA DIVISION.
 WORKING-STORAGE SECTION.

 01 INP    PIC X(100).
 01 A1     PIC 9(3).
 01 A2     PIC 9(3).
 01 A3     PIC 9(3).
 01 B1     PIC 9(3).
 01 B2     PIC 9(3).
 01 B3     PIC 9(3).
 01 C1     PIC 9(3).
 01 C2     PIC 9(3).
 01 ANS    PIC ZZ9.

 PROCEDURE DIVISION.
 
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ALL ' '
      INTO B1 B2 B3.

  EVALUATE TRUE
     WHEN (B1 > B2) AND (B1 > B3)
     WHEN (B1 = B2) AND (B1 > B3)
     WHEN (B1 = B2) AND (B1 = B3)
       MOVE B1 TO A1
       MOVE B2 TO A2
       MOVE B3 TO A3
     WHEN (B2 > B1) AND (B2 > B3)
     WHEN (B2 = B1) AND (B2 > B3)
       MOVE B2 TO A1
       MOVE B1 TO A2
       MOVE B3 TO A3
     WHEN (B3 > B1) AND (B3 > B2)
     WHEN (B3 = B1) AND (B3 > B2)
       MOVE B3 TO A1
       MOVE B1 TO A2
       MOVE B2 TO A3
     WHEN OTHER
       CONTINUE
  END-EVALUATE.       

  IF A1 > A3
    COMPUTE C1 = A1 - A3
  ELSE
    COMPUTE C1 = A3 - A1
  END-IF.

  IF A2 > A3
    COMPUTE C2 = A2 - A3
  ELSE
    COMPUTE C2 = A3 - A2
  END-IF.

  COMPUTE ANS = C1 + C2.
  DISPLAY ANS.

  STOP RUN. 