Your program will be provided with a series of observations from a very primitive weather station. On each day, the station records just two pieces of information: what the weather was like ("rain", "snow", or "sun" are the only possibilities), and the average temperature for the day (a whole number, in degrees fahrenheit).
This data should be read, and reduced to just four statistics: The total number of observations, the average temperature for all sunny days, the average temperature for all rainy days, and the average temperature for all snowy days.
Each of the three averages must be rounded to the nearest whole number. Do not attempt to print a statistic that does not exist (if there are no snowy days in the input data, do not print the average temperature for snowy days).
Each observation will be on a single line, and consist of an integer (giving the temperature) and a string (which will be one of "snow", "rain", or "sun"). The two items on each line will be separated by a space.
The end of the data set will be signalled by a line containing the string "end" and the number 0.
The output of the program should be in exactly the following form:
N1 observations
average temperature for sunny days N2
average temperature for rainy days N3
average temperature for snowy days N4
with N1, N2, N3, and N4 replaced by the appropriate intgers.
Except that if there were no observations for sunny days, the second line should be omitted, and if there were no observations for rainy days, the third line should be omitted, and if there were no observations for snowy days, the fourth line should be omitted.
30 snow 31 snow 39 rain 42 rain 44 rain 45 rain 49 sun 47 rain 52 sun 56 sun 47 rain 29 snow 35 rain 0 end
13 observations average temperature for sunny days 52 average temperature for rainy days 43 average temperature for snowy days 30