/* Author:MH RIYAD
LANGUAGE:C++
*/
#include<iostream>
#include<cstdio>
#include<string>
#include<map>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<vector>
#include<stack>
#define inf 100000000
#define pi acos(-1.0)
#define READ freopen("input.txt","r",stdin);
#define WRITE freopen ("out.txt","w",stdout);
#define maax 1000006
using namespace std;
int main()
{
// READ
char ss[500];
map<string,string>mp;
map<string,string>::iterator it;
map<string,int>::iterator itt;
map<string,int>mep;
while(gets(ss))
{
if(ss[0]=='#') break;
char *ptr=strtok(ss," ");
while(ptr!=NULL)
{
string s=ptr;
string temp=s;
for(int i=0; i<temp.size(); i++) temp[i]=tolower(temp[i]);
sort(temp.begin(),temp.end());
mep[temp]++;
mp[s]= temp;
ptr=strtok(NULL," ");
}
}
for(it=mp.begin(); it!=mp.end(); it++)
{
string a=it->first;
string b=it->second;
if(mep[b]==1) cout<<a<<endl;
}
return 0;
}
LANGUAGE:C++
*/
#include<iostream>
#include<cstdio>
#include<string>
#include<map>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<vector>
#include<stack>
#define inf 100000000
#define pi acos(-1.0)
#define READ freopen("input.txt","r",stdin);
#define WRITE freopen ("out.txt","w",stdout);
#define maax 1000006
using namespace std;
int main()
{
// READ
char ss[500];
map<string,string>mp;
map<string,string>::iterator it;
map<string,int>::iterator itt;
map<string,int>mep;
while(gets(ss))
{
if(ss[0]=='#') break;
char *ptr=strtok(ss," ");
while(ptr!=NULL)
{
string s=ptr;
string temp=s;
for(int i=0; i<temp.size(); i++) temp[i]=tolower(temp[i]);
sort(temp.begin(),temp.end());
mep[temp]++;
mp[s]= temp;
ptr=strtok(NULL," ");
}
}
for(it=mp.begin(); it!=mp.end(); it++)
{
string a=it->first;
string b=it->second;
if(mep[b]==1) cout<<a<<endl;
}
return 0;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন