and here is the full program #include <iostream> #include <cstring> using namespace std; void Swap(char**& str1, char**& str2) { char** temp = str1; str1 = str2; str2 = temp; } char** Parse(char* str, int& count) { count = 0; for (int i = 0; str[i] != '0'; i++) { if (str[i] == ' ') { count++; } } count++; // add 1 for the last word char** words = new char* [count]; const char* delim = " "; char* next_token; char* token; int i = 0; token = strtok_s(str, delim, &next_token); while (token) { words[i] = new char[strlen(token) + 1]; strcpy_s(words[i], strlen(token) + 1, token); i++; token = strtok_s(NULL, delim, &next_token); } return words; } void Sort(char** words, int count) { for (int i = 0; i < count - 1; i++) { for (int j = i + 1; j < count; j++) { if (stricmp(words[i], words[j]) > 0) { Swap(words[i], words[j]); } } } } int CountSimilar(char** words1, int count1, char** words2, int count2) { int similar = 0; for (int i = 0; i < count1; i++) { for (int j = 0; j < count2; j++) { if (stricmp(words1[i], words2[j]) == 0) { similar++; } } } return similar; } int main() { char paragraph1[500]; cout << "Enter the first paragraph (up to 3 lines): "; cin.getline(paragraph1, 500); int count1; char** words1 = Parse(paragraph1, count1); Sort(words1, count1); char paragraph2[500]; cout << "Enter the second paragraph (up to 3 lines): "; cin.getline(paragraph2, 500); int count2; char** words2 = Parse(paragraph2, count2); int similar = CountSimilar(words1, count1, words2, count2); cout << "nSorted first paragraph: "; for (int i = 0; i < count1; i++) { cout << words1[i] << " "; } cout << "nNumber of similar words: " << similar << endl; // deallocate memory for (int i = 0; i < count1; i++) { delete[] words1[i]; } delete[] words1; for (int i = 0; i < count2; i++) { delete[] words2[i]; } delete[] words2; return 0; } #include <iostream> #include <cstring> using namespace std; void Swap(char**& str1, char**& str2) { char** temp = str1; str1 = str2; str2 = temp; } char** Parse(char* str, int& count) { count = 0; for (int i = 0; str[i] != '0'; i++) { if (str[i] == ' ') { count++; } } count++; // add 1 for the last word char** words = new char* [count]; const char* delim = " "; char* next_token; char* token; int i = 0; token = strtok_s(str, delim, &next_token); while (token) { words[i] = new char[strlen(token) + 1]; strcpy_s(words[i], strlen(token) + 1, token); i++; token = strtok_s(NULL, delim, &next_token); } return words; } void Sort(char** words, int count) { for (int i = 0; i < count - 1; i++) { for (int j = i + 1; j < count; j++) { if (stricmp(words[i], words[j]) > 0) { Swap(words[i], words[j]); } } } } int CountSimilar(char** words1, int count1, char** words2, int count2) { int similar = 0; for (int i = 0; i < count1; i++) { for (int j = 0; j < count2; j++) { if (stricmp(words1[i], words2[j]) == 0) { similar++; } } } return similar; } int main() { char paragraph1[500]; cout << "Enter the first paragraph (up to 3 lines): "; cin.getline(paragraph1, 500); int cou.