#K45322. Find the Largest Integer from a Comma-Separated String
Find the Largest Integer from a Comma-Separated String
Find the Largest Integer from a Comma-Separated String
Given a string of integers separated by commas, your task is to find and output the largest integer. The input string can contain spaces around the numbers, and the numbers can be positive, negative, or even a single number.
For example, if the input is 1, 2, 3, 4, 5
, the output should be 5
.
Note: Ensure that you correctly handle any extra spaces around the numbers. The formula for the answer is: ( \max_{1 \leq i \leq n} a_i ) where (a_i) are the parsed integers.
inputFormat
The input consists of a single line read from standard input (stdin) which contains a comma-separated list of integers. Each integer may be preceded or followed by spaces.
outputFormat
Output a single integer to standard output (stdout) which is the largest integer in the list.## sample
1, 2, 3, 4, 5
5