【链接】 我是链接,点我呀:)
【题意】
【题解】
每个字符串如果每个字符按照升序排一下。假设他们能够互相变化。 则肯定是一样的。 根据这个东西,用一个map来判重就好。【错的次数】
在这里输入错的次数【反思】
在这里输入反思【代码】
#include <bits/stdc++.h>
using namespace std;
string s;
vector<string> words, ans;
map <string, int> mymap;
string pack(string t)
{
int len = t.size();
for (int i = 0; i < len; i++)
t[i] = tolower(t[i]);
sort(t.begin(), t.end());
return t;
}
int main()
{
//freopen("F:\rush.txt", "r", stdin);
ios::sync_with_stdio(0), cin.tie(0);
while (cin >> s)
{
if (s[0] == '#') break;
words.push_back(s);
mymap[pack(s)]++;
}
int len = words.size();
for (int i = 0; i < len; i++)
if (mymap[pack(words[i])] == 1)
ans.push_back(words[i]);
sort(ans.begin(), ans.end());
for (string x : ans)
cout << x << endl;
return 0;
}