Did you use a string library when working in C? C's deficiencies when it comes to string handling are well-known.
I am sure, my task would have been easier if I had used some lib. But my main concern (and goal) was performance and memory usage comparison.