i am trying to write a recursion which finds the longest sequence of string2 containting only letters from string1. for example if string1="abc" and string2="wacdbgabcf" the answer will be 4 as "acdb" is the longest substring of s2 containg only letters from string1.
to answer this question with recursion i decided first to find the number of letters of string1 in
string 2 so wrote the following code
i think that it doesn't work because substring takes the right part of the string and i am searching from the left side but i don't have any idea how to fix it.
1. can you help me solve the problem?
2. am i going in the right way to solve the original problem or should i use a different way?
thanks.