I want to find numerical pairs in the input, and then sum these pairs, but leave unpaired numbers. By this I mean
8 8 8 = 16
8 8 8 8 8 = 32
therefore, numbers with two of the two will be counted, but a number that does not have a pair will not be counted. Sorry if I phrased this weirdly, I don’t know how to explain it, but an example will help.
For example:
8 3 4 4 5 9 9 5 2
Output:
36
4 + 4 + 5 + 5 + 9 + 9 = 36
In Python.
source
share