//my program should be able to collect two words and compare them outputing the words from word1 which are also in word2 and outputing them and viceversa. my problem is in the last four lines before the return. Please help
//Program to shows analysis of texts
#include <iostream> // for cin, cout
#include <string>
#include <iomanip>
using namespace std;
int main()
{
string word1, word2; //declaration of words
// Welcome message
cout<< "------------------------------------------------\n"
<< " Topiloe's Text analyzer - Release 1.0 \n"
<< "------------------------------------------------\n\n";
cout<<"Enter two words on one line: ";
cin>>word1>>word2;
cout<<"Second word you entered is <"<<word2<<"> \n";
cout<<"It is "<<word2.length()<<" characters long\n";
cout<<"Starts with the letter '"<<word2.substr(0,1)<<"'\n";
int last_word;
last_word=word2.length()-1;
cout<<"Ends with the letter '"<<word2.substr(last_word,1)<<"'\n\n";
cout<<"First word you entered is <"<<word1<<"> \n";
cout<<"It is "<<word1.length()<<" characters long\n";
cout<<"Starts with the letter '"<<word1.substr(0,1)<<"'\n";
last_word=word1.length()-1;
cout<<"Ends with the letter '"<<word1.substr(last_word,1)<<"'\n\n";
cout<<"The leters in <"<<word1<<"> which are also in <"<<word2<<"> are"<<word1.find(word2)<<endl;
cout<<"There are "<<word1.find(word2)<<" words in "<<word1<<" which are also in "<<word2<<endl;
cout<<"The leters in <"<<word2<<"> which are also in <"<<word1<<"> are"<<word2.find(word1)<<endl;
cout<<"There are "<<word2.find(word1)<<" words in "<<word2<<" which are also in "<<word1<<endl;
return 0;
}