Examples:
Input: s1 = ABHISHEKsinGH: s2 = gfhfBHkooIHnfndSHEKsiAnG Output: Possible Input: s1 = Hello: s2 = dnaKfhelddf Output: Not Possible Input: s1 = GeekfogforGeeks: s1 = GeeksforGeeks: s2 = rtehes OutputGeks / pre>We have a solution to this problem, please refer to Create a string from another by removing and rearranging characters . We’ll quickly fix this problem in python. The approach is very simple,
- Convert both strings to a dictionary using intersection two dictionaries and compare the resulting output with the dictionary of the first line, if they are both equal, this means that otherwise you can convert the string.
|
Exit:
Possible