#K44482. Difference Between Maximum and Minimum

    ID: 27541 Type: Default 1000ms 256MiB

Difference Between Maximum and Minimum

Difference Between Maximum and Minimum

Given a string of comma-separated integers, your task is to compute the difference between the maximum and minimum integer in the list.

The input is provided via standard input (stdin) and consists of a single line containing the numbers separated by commas. The output should be sent to standard output (stdout) as an integer.

For example, given the input 3,-1,9,17,-33, the maximum number is 17 and the minimum is -33, so the output should be 50.

Note: In cases where there is only one number, the result will be 0 because the maximum and minimum are the same.

inputFormat

A single line containing a comma-separated list of integers. For example: 3,-1,9,17,-33

outputFormat

An integer representing the difference between the maximum and minimum integers in the input.## sample

3,-1,9,17,-33
50