Problem 100

Problem description here

The standard solution for this problem is to loop over the first string, remove all the characters that appear in the second string and then repeat the same with second string removing the characters that appear in the first one.

After some time, competitors realized that this problem can be solved with regular expression.
Here is the solution of teddy

Some were discussing that there is absolutely no possibility for this to be shorter, and the Goran submitted this solution:


This solution is quite genious as it creates the regular expression in a form

  • "["+f+"&&"+s+"]" which means each character that appears in both f and s strings.