+ 1

How to continue over a character?

https://code.sololearn.com/cp69KyAH958K/?ref=app How to check if we can get a string from another string. In this example there is one 'a' but we need two. So we can't pass because it takes 'a' two times. It is not correct because we can take it only once.

2nd Apr 2022, 4:20 AM
TeaserCode
4 Respostas
+ 1
Hmm, I don't have this as code, but could you destroy the letter when it is found? Make a duplicate of the target, each time you find a letter from the source in the target, you delete that character place in the target. Eg: find 'crabby' in Cantebury, first run finds 'c' at target[0], so replace target[0] with '_', end that run. 2nd run searches for 'r', finds it at target[7], replaces that, ends that run. ... 5th search for 'b', doesn't find it because target[5] is already destroyed. Search fails. https://code.sololearn.com/cmHYDSam5P6i/?ref=app
2nd Apr 2022, 5:33 AM
HungryTradie
HungryTradie - avatar
+ 1
I have found it, it must be like I do.
2nd Apr 2022, 6:59 AM
TeaserCode
0
Hello me again, I tried this program in the other compiler and it prints me wrong result??? I don't know why
2nd Apr 2022, 5:45 PM
TeaserCode