#C3226. Array Exclusion Sum
Array Exclusion Sum
Array Exclusion Sum
Given an array of integers, construct a new array such that each element at index \(i\) is equal to the sum of all the elements in the original array except the one at index \(i\). For example, if the array is \([1, 2, 3, 4]\), the output should be \([9, 8, 7, 6]\) because \(9 = 2+3+4\), \(8 = 1+3+4\), etc.
Your task is to implement this functionality. The input will be provided via standard input (stdin) and the output must be written to standard output (stdout).
inputFormat
The first line contains an integer \(n\) representing the number of elements in the array. The second line contains \(n\) space-separated integers.
For example:
4 1 2 3 4
outputFormat
Output a single line containing \(n\) space-separated integers. The \(i\)-th integer in the output should be the sum of all the array elements except the element at the \(i\)-th position.
For the input above, the output should be:
9 8 7 6## sample
4
1 2 3 4
9 8 7 6