題目:
https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=92
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| #include <bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #define pb push_back #define eb emplace_back #define mp make_pair #define INF 0x3f3f3f3f #define all(x) (x).begin(), (x).end()
using namespace std; using ll = long long; using pii = pair<int, int>;
set<string> s; map<string, int> dict; map<string, string> trans; string input, modify;
int main() { ios_base::sync_with_stdio(false); cin.tie(NULL);
while(cin >> input && input != "#"){ modify = input; for(char& c : modify){ if(isupper(c)) c = tolower(c); } sort(modify.begin(), modify.end()); dict[modify]++; trans[modify] = input; }
for(auto& p : dict){ if(p.second == 1) s.insert(trans[p.first]); } for(auto& str : s){ cout << str << '\n'; } return 0; }
|