I wouldn't feel bad. The advanced answers to this question require spending a lot of time understanding string processing. It's like having a CSS question that can be implemented multiple ways: a simple, obvious, slow way and a complicated, "deep knowledge required", fast way. If you have lots of experience with CSS, you might get the fast way, but it doesn't really say how good a programmer you are.
(Yes, not a perfect analogy, but it hopefully gives the idea.)
(Yes, not a perfect analogy, but it hopefully gives the idea.)