Agreed; this is likely to be quite difficult if you try to do this character-by-character. Separate the words into strings, using arrays or vectors to store individual strings, then for each word in the input, check if it exists in the second, then display word or word-x accordingly.

By the way, when posting code PLEASE USE CODE TAGS. It's detailed in the posting guidelines. Failure to comply with this probably won't get you banned, but it'll probably get you ignored; if you can't be arsed to use simple code tags, why should we be arsed to help you?