Write a function with the prototype void findMisspellings(const char *text, const char *correctlySpelled, char *result) which populates the string result containing all the words in text that are misspelled, in the order they appear in text, with a single space separating each word and no leading or trailing whitespace. A word is considered to be misspelled if it doesn't appear in correctlySpelled.
In each of text and correctlySpelled, a collection of characters is considered to be a word if it is separated from the rest of the string by at least one non-letter character. A character is a letter if it is an alphanumeric character (a-z, A-Z, 0-9).
For example, if text was the following string:
“This is a.... string, with s0me strange STUff?”
The words would be:
This, is, a, string, with, s0me, strange, STUff
For making comparisons between words in text and correctlySpelled, ignore case. For example, if text was “A string” and correctlySpelled was “STRIng”, the word “A” would be considered mispelled, but the word “string” would not. Note that the words in result must be in the case they appear in text.
You are not allowed to modify the contents of text or correctlySpelled. You are guaranteed that result is large enough to store the misspelled words. Your program will crash if it attempts to write past the end of result, and no marks will be awarded for any tests this occurs in. There will be less than 1000 characters in both text and correctlySpelled.