The pieces of the problem are the individual characters in the string.
Often you need to carefully study a problem to find the right size pieces. The right size is sometimes called the grain size of a problem. If you pick the right grain size, the problem fits naturally into the flow chart.
In practice you would use a C library function to do this. But let us say that you do not have such a function. In this case, your code should iterate over the string, character by character.
For a loop, three things need to be done
What three things should be done for our loop?
Think in terms of the characters in the string. Recall that we are working with a null-terminated string.