Capping Extreme Ratings
Fenwick College moved its course-feedback form from a ten-point scale to a five-point one, but a pile of submissions on the old form is still waiting to be processed. Any rating above 5 came from the old form and has to be brought down to 5 so that both sets can appear in one report. A rating of 5 or below is already on the new scale and must pass through untouched. Submission order matters, because each rating is tied to a course further down the sheet.
Task: Print the ratings once the old-scale ones have been brought down, in submission order.
Input
The first line holds a single integer n, the number of ratings. Each of the next n lines holds one rating: a whole number, at least 1.
Output
One line holding all n ratings in submission order, separated by single spaces. Write each as a whole number, with no brackets and no commas.
Example:
Input:
4
3
7
5
9
Output:
3 5 5 5
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in