সমস্যা ও সমাধান বই - ১ এর উপর অনুশীলন ( Practice code for Problem and Solutions Book - 1 by Mahbubul Hasan )
Commit Time | 15 Oct 2017 14:44 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
map<string, int> count;
string w;
vector<string> words;
while (cin>>w) {
if(w == "#") break;
words.push_back(w);
transform(w.begin(), w.end(), w.begin(), ::tolower);
sort(w.begin(), w.end());
count[w]++;
}
vector<string> ans;
for(auto word: words) {
string w = word;
transform(w.begin(), w.end(), w.begin(), ::tolower);
sort(w.begin(), w.end());
if(count[w] == 1) {
ans.push_back(word);
}
}
sort(ans.begin(), ans.end());
for(auto w: ans) {
cout<<w<<endl;
}
return 0;
}