ACan someone explain me this test case? I can't understand why should I output no , and my solution passes 8/10 test cases. :-(
Sample Input:
east west wesseatt
Sample Output:
no
tWho could you get "east" by erasing some letters from "wesseatt"?
AAham, i get it now. I didn't figured out the text of the task. Thanks. :)
fI'm trying to solve it recursively, by trying out every possible way of dividing the third string. However I'm getting 7/10. I can't seem to find whats wrong with my code. Could someone give me a tricky case? Maybe then I could debug it.
fwow... I found my error. I was reading info from an input file. I had forgotten to remove it. lol. Apparently my program always returned "no".
iDividing? Hm... I used recursive aproach also, with three integer parameters (i,j,k) which represented current positions in every one of given three strings.
If you get to the end of all three strings, then return "yes".
If you get to the end of the first two strings, but not third, return "no".
If current character of first string is equal to current character of third string, check whether rek(i+1,j,k+1) returns "yes" and if it is, return it further.
Else check if current character of second string is equal to current character of third string and return rek(i,j+1,k+1).
From main program you should call rek(0,0,0).
This should get the job done.
iOh sorry, you answered in the meantime, while I was writing my post. Anyway, it may be helpful to someone else.. Cheers! ;)
fYep, that's almost exactly how I solve it.
gHey iggy91...
Can you help me and look in my code and tell me what's wrong with it.
I'm not so good with recursions but I want to learn about it.
I want to solve this task just like you said.
Thanks :) :)
pYou can't read 3 strings in the same line with 3 ReadLn.
gIt's the same :S
Something is wrong with the function... :S :S
gCrap !
I always fail on three of the test cases. Please tell me what to do ! :@ I'm going crazy!