#C14728. Replace with Difference from Average
Replace with Difference from Average
Replace with Difference from Average
You are given a list of numbers. Your task is to replace each number with the difference between that number and the average of the list. Formally, if the list is \(a_1, a_2, \ldots, a_n\), then the average is \(\bar{a}=\frac{\sum_{i=1}^{n}a_i}{n}\) and each element should be replaced with \(a_i-\bar{a}\). For example, if the input list is [1, 2, 3, 4, 5] then the average is 3 and the output should be [-2, -1, 0, 1, 2].
If the list is empty, simply output nothing.
inputFormat
The input is read from standard input. The first line contains an integer \(n\) (the number of elements in the list). If \(n > 0\), the second line contains \(n\) space-separated numbers.
outputFormat
The output is written to standard output. Print a single line with \(n\) space-separated numbers, where each number is the difference between the corresponding input number and the average of the list. If the list is empty, output nothing.
## sample0