When you encounter a character, put it in a char array.
When an array is encountered, it is also put into a char array.
Change the char array when a boundary is encountered (that is, character to number, or number to character).
Finally, the n char arrays you get are what you want. For those with numbers in them, atoi conversion is used.