-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11328.cpp
More file actions
46 lines (40 loc) · 733 Bytes
/
11328.cpp
File metadata and controls
46 lines (40 loc) · 733 Bytes
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
43
44
45
46
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
int count;
cin >> count;
for (int i = 0; i < count; i++){
string t1;
string t2;
cin >> t1, cin >> t2;
bool flag = true;
vector<char> v1;
vector<char> v2;
for (int j = 0; j < t1.size(); j++){
v1.push_back(t1[j]);
v2.push_back(t2[j]);
}
if (v1.size() != v2.size()){
cout << "Impossible\n";
continue;
}
sort(v1.begin(), v1.end());
sort(v2.begin(), v2.end());
for (int j= 0; j < v1.size(); j++){
if (v1[j] == v2[j])
continue;
else{
flag = false;
break;
}
}
if (flag == true)
cout << "Possible\n";
else
cout << "Impossible\n";
}
return 0;
}