Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <algorithm>
- #include <cstring>
- #include <string>
- #include <cctype>
- #include <stack>
- #include <queue>
- #include <list>
- #include <vector>
- #include <map>
- #include <set>
- #include <sstream>
- #include <stdlib.h>
- #include <cmath>
- #define FOR(i,A) for(typeof (A).begin() i = (A).begin() ; i != (A).end() ; i++)
- #define debug( x ) cout << #x << " = " << x << endl
- #define clr(v,x) memset( v, x , sizeof v )
- #define all(x) (x).begin() , (x).end()
- #define rall(x) (x).rbegin() , (x).rend()
- #define TAM 110
- #define FOI(i, A, B) for(i=A; i<=B; i++)
- #define FOD(i, A, B) for(i=A; i>=B; i--)
- using namespace std;
- typedef pair<int,int> ii ;
- typedef long long ll ;
- typedef long double ld ;
- typedef pair<int,ii> pii ;
- string rem(string S){
- sort(S.begin(), S.end());
- int L = S.length() - 1, i;
- string R = "";
- FOI(i, 0, L)
- if (!isspace(S[i]))
- R += S[i];
- return R;
- }
- int main(){
- int T;
- cin >> T;
- string str;
- getline(cin, str); getline(cin, str);
- while (T--){
- vector< string > V;
- map<string, string> Map;
- while (getline(cin, str)){
- if (str == "")
- break;
- V.push_back(str);
- Map[str] = rem(str);
- }
- sort(V.begin(), V.end());
- int SZ = V.size() - 1;
- int i, j;
- FOI(i, 0, SZ)
- FOI(j, i+1, SZ)
- if (Map[V[i]] == Map[V[j]])
- cout << V[i] << " = " << V[j] << endl;
- if (T)
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement