Skip to content

Instantly share code, notes, and snippets.

View Norwae's full-sized avatar

Norwae

View GitHub Profile
The origin of the question is http://stackoverflow.com/q/25949977/3185992 where user Sri asked about a problem he had.
The problem is not that hard to solve, but the answers got me concerned that there must be a more elegant way of doing this.
I wanted something with meaningful intermediate results, which is composable and not some nested for loops which at the end will result in the right thing.
Problem description:
====================
Given two strings compute the count of characters which are not common in both of them.
However each character "counts of its own", that is if a character is included in the first string 2 times and a single time in the second one, the right answer for this character is: 1.
Example from the user: