#K43267. Sales Data Analysis
Sales Data Analysis
Sales Data Analysis
You are given several datasets representing cup sales during different time periods in a day. Each dataset consists of 5 integers corresponding to sales in the following periods: Morning, Afternoon, Evening, Night, and Other.
Your task is to determine the time period with the highest sales for each dataset. Mathematically, if a dataset is represented as \( (m, a, e, n, o) \), then you need to find \[ max_{i}\{x_i\} = \max\{ m, a, e, n, o \}\] where each \( x_i \) corresponds to one of the time periods. Output the corresponding letter along with the maximum sales number.
Note: Input is terminated by a line containing five zeroes.
inputFormat
The input consists of multiple lines, each containing exactly 5 integers separated by spaces. Each integer represents the number of cups sold during a period in the order (M A E N O). The input terminates with a line that contains "0 0 0 0 0", which should not be processed.
outputFormat
For each dataset (except the termination line), output a line with two items: the letter corresponding to the time period with the highest sales and the maximum sales number, separated by a space.
For example, if the maximum sales in a dataset are 3000 in the afternoon, output:
A 3000## sample
1500 3000 2500 2000 1800
1000 2000 1500 2500 3000
3500 2800 2900 3100 2700
0 0 0 0 0
A 3000
O 3000
M 3500
</p>