I want to check if string1 can be made by taking characters from string2 and putting them in the right order. What would be the most effective way to do that?
For example, I have 2 strings as shown below:
string s1 = "ABCDASFSADFAF", s2 ="ABCDFGSAGSRASFSFASFASDADFAFDSAGFAS";
as you can see, we can make string s1 from the characters in string s2, so string1 exists in string2. So basically, I need to check if you can make string s1 from string s2. what would be the most effective way to do something like that? I had an idea, to go through with loop, and check how many times each letter is in string, and then do the same with second string, then just compare the array's with stored information, and if string s2 letter array has more or equal to string s1 array letters, then we will be able to make s1 from s2.
Oh and programming language is C++.