Language: C++

#include<iostream>
#include<sstream>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;




int main()
{
&#160; int n;
&#160; string s;
&#160; char k;
&#160; while(cin>>n,n){
&#160; &#160; map<string,int>used;
&#160; &#160; for(int i=0;i<n;i++){
&#160; &#160; &#160; cin.ignore();
&#160; &#160; &#160; getline(cin,s);
&#160; &#160; &#160; stringstream ss(s);
&#160; &#160; &#160; string word;
&#160; &#160; &#160; while(ss>>word){
&#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1));
&#160; &#160; &#160; &#160; else used[word]++;
&#160; &#160; &#160; }
&#160; &#160; }
&#160; &#160; cin>>k;
&#160; &#160; map<string,int>::iterator it;
&#160; &#160; vector<string>v;
&#160; &#160; for(it=used.begin();it!=used.end();it++){
&#160; &#160; &#160; if(it->first[0]!=k)continue;
&#160; &#160; &#160; v.push_back(it->first);
&#160; &#160; }
&#160; &#160; sort(v.begin(),v.end());
&#160; &#160; if(v.empty()){
&#160; &#160; &#160; puts("NA");
&#160; &#160; }else{
&#160; &#160; &#160; int cnt=0;
&#160; &#160; &#160; for(int i=0;i<v.size();i++){
&#160; &#160; &#160; &#160; if(++cnt>5)break;
&#160; &#160; &#160; &#160; if(i!=0)cout<<" ";
&#160; &#160; &#160; &#160; cout<<v[i];
&#160; &#160; &#160; }
&#160; &#160; &#160; cout<<endl;
&#160; &#160; }
&#160; }
}

Compiler output:
a.cc:13:2: error: stray '#' in program
   13 | &#160; int n;
      |  ^
a.cc:14:2: error: stray '#' in program
   14 | &#160; string s;
      |  ^
a.cc:15:2: error: stray '#' in program
   15 | &#160; char k;
      |  ^
a.cc:16:2: error: stray '#' in program
   16 | &#160; while(cin>>n,n){
      |  ^
a.cc:17:2: error: stray '#' in program
   17 | &#160; &#160; map<string,int>used;
      |  ^
a.cc:17:9: error: stray '#' in program
   17 | &#160; &#160; map<string,int>used;
      |         ^
a.cc:18:2: error: stray '#' in program
   18 | &#160; &#160; for(int i=0;i<n;i++){
      |  ^
a.cc:18:9: error: stray '#' in program
   18 | &#160; &#160; for(int i=0;i<n;i++){
      |         ^
a.cc:19:2: error: stray '#' in program
   19 | &#160; &#160; &#160; cin.ignore();
      |  ^
a.cc:19:9: error: stray '#' in program
   19 | &#160; &#160; &#160; cin.ignore();
      |         ^
a.cc:19:16: error: stray '#' in program
   19 | &#160; &#160; &#160; cin.ignore();
      |                ^
a.cc:20:2: error: stray '#' in program
   20 | &#160; &#160; &#160; getline(cin,s);
      |  ^
a.cc:20:9: error: stray '#' in program
   20 | &#160; &#160; &#160; getline(cin,s);
      |         ^
a.cc:20:16: error: stray '#' in program
   20 | &#160; &#160; &#160; getline(cin,s);
      |                ^
a.cc:21:2: error: stray '#' in program
   21 | &#160; &#160; &#160; stringstream ss(s);
      |  ^
a.cc:21:9: error: stray '#' in program
   21 | &#160; &#160; &#160; stringstream ss(s);
      |         ^
a.cc:21:16: error: stray '#' in program
   21 | &#160; &#160; &#160; stringstream ss(s);
      |                ^
a.cc:22:2: error: stray '#' in program
   22 | &#160; &#160; &#160; string word;
      |  ^
a.cc:22:9: error: stray '#' in program
   22 | &#160; &#160; &#160; string word;
      |         ^
a.cc:22:16: error: stray '#' in program
   22 | &#160; &#160; &#160; string word;
      |                ^
a.cc:23:2: error: stray '#' in program
   23 | &#160; &#160; &#160; while(ss>>word){
      |  ^
a.cc:23:9: error: stray '#' in program
   23 | &#160; &#160; &#160; while(ss>>word){
      |         ^
a.cc:23:16: error: stray '#' in program
   23 | &#160; &#160; &#160; while(ss>>word){
      |                ^
a.cc:24:2: error: stray '#' in program
   24 | &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1));
      |  ^
a.cc:24:9: error: stray '#' in program
   24 | &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1));
      |         ^
a.cc:24:16: error: stray '#' in program
   24 | &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1));
      |                ^
a.cc:24:23: error: stray '#' in program
   24 | &#160; &#160; &#160; &#160; if(used.find(word)==used.end())used.insert(make_pair(word,1));
      |                       ^
a.cc:25:2: error: stray '#' in program
   25 | &#160; &#160; &#160; &#160; else used[word]++;
      |  ^
a.cc:25:9: error: stray '#' in program
   25 | &#160; &#160; &#160; &#160; else used[word]++;
      |         ^
a.cc:25:16: error: stray '#' in program
   25 | &#160; &#160; &#160; &#160; else used[word]++;
      |                ^
a.cc:25:23: error: stray '#' in program
   25 | &#160; &#160; &#160; &#160; else used[word]++;
      |                       ^
a.cc:26:2: error: stray '#' in program
   26 | &#160; &#160; &#160; }
      |  ^
a.cc:26:9: error: stray '#' in program
   26 | &#160; &#160; &#160; }
      |         ^
a.cc:26:16: error: stray '#' in program
   26 | &#160; &#160; &#160; }
      |                ^
a.cc:27:2: error: stray '#' in program
   27 | &#160; &#160; }
      |  ^
a.cc:27:9: error: stray '#' in program
   27 | &#160; &#160; }
      |         ^
a.cc:28:2: error: stray '#' in program
   28 | &#160; &#160; cin>>k;
      |  ^
a.cc:28:9: error: stray '#' in program
   28 | &#160; &#160; cin>>k;
      |         ^
a.cc:29:2: error: stray '#' in program
   29 | &#160; &#160; map<string,int>::iterator it;
      |  ^
a.cc:29:9: error: stray '#' in program
   29 | &#160; &#160; map<string,int>::iterator it;
      |         ^
a.cc:30:2: error: stray '#' in program
   30 | &#160; &#160; vector<string>v;
      |  ^
a.cc:30:9: error: stray '#' in program
   30 | &#160; &#160; vector<string>v;
      |         ^
a.cc:31:2: error: stray '#' in program
   31 | &#160; &#160; for(it=used.begin();it!=used.end();it++){
      |  ^
a.cc:31:9: error: stray '#' in program
   31 | &#160; &#160; for(it=used.begin();it!=used.end();it++){
      |         ^
a.cc:32:2: error: stray '#' in program
   32 | &#160; &#160; &#160; if(it->first[0]!=k)continue;
      |  ^
a.cc:32:9: error: stray '#' in program
   32 | &#160; &#160; &#160; if(it->first[0]!=k)continue;
      |         ^
a.cc:32:16: error: stray '#' in program
   32 | &#160; &#160; &#160; if(it->first[0]!=k)continue;
      |                ^
a.cc:33:2: error: stray '#' in program
   33 | &#160; &#160; &#160; v.push_back(it->first);
      |  ^
a.cc:33:9: error: stray '#' in program
   33 | &#160; &#160; &#160; v.push_back(it->first);
      |         ^
a.cc:33:16: error: stray '#' in program
   33 | &#160; &#160; &#160; v.push_back(it->first);
      |                ^
a.cc:34:2: error: stray '#' in program
   34 | &#160; &#160; }
      |  ^
a.cc:34:9: error: stray '#' in program
   34 | &#160; &#160; }
      |         ^
a.cc:35:2: error: stray '#' in program
   35 | &#160; &#160; sort(v.begin(),v.end());
      |  ^
a.cc:35:9: error: stray '#' in program
   35 | &#160; &#160; sort(v.begin(),v.end());
      |         ^
a.cc:36:2: error: stray '#' in program
   36 | &#160; &#160; if(v.empty()){
      |  ^
a.cc:36:9: error: stray '#' in program
   36 | &#160; &#160; if(v.empty()){
      |         ^
a.cc:37:2: error: stray '#' in program
   37 | &#160; &#160; &#160; puts("NA");
      |  ^
a.cc:37:9: error: stray '#' in program
   37 | &#160; &#160; &#160; puts("NA");
      |         ^
a.cc:37:16: error: stray '#' in program
   37 | &#160; &#160; &#160; puts("NA");
      |                ^
a.cc:38:2: error: stray '#' in program
   38 | &#160; &#160; }else{
      |  ^
a.cc:38:9: error: stray '#' in program
   38 | &#160; &#160; }else{
      |         ^
a.cc:39:2: error: stray '#' in program
   39 | &#160; &#160; &#160; int cnt=0;
      |  ^
a.cc:39:9: error: stray '#' in program
   39 | &#160; &#160; &#160; int cnt=0;
      |         ^
a.cc:39:16: error: stray '#' in program
   39 | &#160; &#160; &#160; int cnt=0;
      |                ^
a.cc:40:2: error: stray '#' in program
   40 | &#160; &#160; &#160; for(int i=0;i<v.size();i++){
      |  ^
a.cc:40:9: error: stray '#' in program
   40 | &#160; &#160; &#160; for(int i=0;i<v.size();i++){
      |         ^
a.cc:40:16: error: stray '#' in program
   40 | &#160; &#160; &#160; for(int i=0;i<v.size();i++){
      |                ^
a.cc:41:2: error: stray '#' in program
   41 | &#160; &#160; &#160; &#160; if(++cnt>5)break;
      |  ^
a.cc:41:9: error: stray '#' in program
   41 | &#160; &#160; &#160; &#160; if(++cnt>5)break;
      |         ^
a.cc:41:16: error: stray '#' in program
   41 | &#160; &#160; &#160; &#160; if(++cnt>5)break;
      |                ^
a.cc:41:23: error: stray '#' in program
   41 | &#160; &#160; &#160; &#160; if(++cnt>5)break;
      |                       ^
a.cc:42:2: error: stray '#' in program
   42 | &#160; &#160; &#160; &#160; if(i!=0)cout<<" ";
      |  ^
a.cc:42:9: error: stray '#' in program
   42 | &#160; &#160; &#160; &#160; if(i!=0)cout<<" ";
      |         ^
a.cc:42:16: error: stray '#' in program
   42 | &#160; &#160; &#160; &#160; if(i!=0)cout<<" ";
      |                ^
a.cc:42:23: error: stray '#' in program
   42 | &#160; &#160; &#160; &#160; if(i!=0)cout<<" ";
      |                       ^
a.cc:43:2: error: stray '#' in program
   43 | &#160; &#160; &#160; &#160; cout<<v[i];
      |  ^
a.cc:43:9: error: stray '#' in program
   43 | &#160; &#160; &#160; &#160; cout<<v[i];
      |         ^
a.cc:43:16: error: stray '#' in program
   43 | &#160; &#160; &#160; &#160; cout<<v[i];
      |                ^
a.cc:43:23: error: stray '#' in program
   43 | &#160; &#160; &#160; &#160; cout<<v[i];
      |                       ^
a.cc:44:2: error: stray '#' in program
   44 | &#160; &#160; &#160; }
      |  ^
a.cc:44:9: error: stray '#' in program
   44 | &#160; &#160; &#160; }
      |         ^
a.cc:44:16: error: stray '#' in program
   44 | &#160; &#160; &#160; }
      |                ^
a.cc:45:2: error: stray '#' in program
   45 | &#160; &#160; &#160; cout<<endl;
      |  ^
a.cc:45:9: error: stray '#' in program
   45 | &#160; &#160; &#160; cout<<endl;
      |         ^
a.cc:45:16: error: stray '#' in program
   45 | &#160; &#160; &#160; cout<<endl;
      |                ^
a.cc:46:2: error: stray '#' in program
   46 | &#160; &#160; }
      |  ^
a.cc:46:9: error: stray '#' in program
   46 | &#160; &#160; }
      |         ^
a.cc:47:2: error: stray '#' in program
   47 | &#160; }
      |  ^
a.cc: In function 'int main()':
a.cc:13:3: error: lvalue required as unary '&' operand
   13 | &#160; int n;
      |   ^~~
a.cc:14:3: error: lvalue required as unary '&' operand
   14 | &#160; string s;
      |   ^~~
a.cc:15:3: error: lvalue required as unary '&' operand
   15 | &#160; char k;
      |   ^~~
a.cc:16:3: error: lvalue required as unary '&' operand
   16 | &#160; while(cin>>n,n){
      |   ^~~
a.cc:17:3: error: lvalue required as unary '&' operand
   17 | &#160; &#160; map<string,int>used;
      |   ^~~
a.cc:17:10: error: lvalue required as unary '&' operand
   17 | &#160; &#160; map<string,int>used;
      |          ^~~
a.cc:18:3: error: lvalue required as unary '&' operand
   18 | &#160; &#160; for(int i=0;i<n;i++){
      |   ^~~
a.cc:18:10: error: lvalue required as unary '&' operand
   18 | &#160; &#160; for(int i=0;i<n;i++){
      |          ^~~
a.cc:19:3: error: lvalue required as unary '&' operand
   19 | &#160; &#160; &#160; cin.ignore();
      |   ^~~
a.cc:19:10: error: lvalue required as unary '&' operand
   19 | &#160; &#160; &#160; cin.ignore();
      |          ^~~
a.cc:19:17: error: lvalue required as unary '&' operand
   19 | &#160; &#160; &#160; cin.ignore();
      |                 ^~~
a.cc: