#include<bits stdc++.h=""> using namespace std; #define c temp[j] int main() { ios::sync_with_stdio(false); vector<string> words; string temp,uni; int N,i,j,start,no=0; //Input and Computation cin >> N; for(i = 0;i < N;i++) { getline(cin,temp);//Getting the line of text start = 0; for(j = 0;j < (int)temp.length();j++)//Extracting words and storing in vector { if(c >= 65 && c <= 90) c = c + 32; if(c == ' '||c == '.'||c == ';'||c == ','||c == ':') { uni = temp.substr(start,j-start-1); words.push_back(uni); no++; start = j; } } temp = ""; } sort(words.begin(),words.end()); //Output cout << no; for(i = 0;i < no-1;i++)//Removing duplicates { if(words[i] != words[i+1]) cout << words[i] <<'\n'; } cout << words[no-1]; return 0; }
uni = temp.substr(start,j-start-1);
temp.substr(0, -1);
cout << words[no-1];
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)