You are given a string. You can remove any two identical adjacent characters. Now you have to tell the minimum length possible after performing unlimited operations?
Solution given in the link has time complexity of O(n^2). But the solution given below has O(n) time complexity.
Given two strings s1 and s2. Modify both the strings such that all the common characters of s1 and s2 are to be removed and the uncommon characters of s1 and s2 are to be concatenated. Note: If all characters are removed print -1.