-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11328.cpp
More file actions
34 lines (31 loc) · 738 Bytes
/
11328.cpp
File metadata and controls
34 lines (31 loc) · 738 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
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
cin.tie(nullptr);
cout.tie(nullptr);
ios::sync_with_stdio(false);
int N;
cin >> N;
while (N--)
{
string a, b;
cin >> a >> b;
int map[27][2];
for (int i = 0; i < 27; i++)
map[i][0] = map[i][1] = 0;
for (int i = 0; i < a.length(); i++)
map[a[i] - 'a'][0]++;
for (int i = 0; i < b.length(); i++)
map[b[i] - 'a'][1]++;
int result = 0;
for (int i = 0; i < 27; i++)
{
result += abs(map[i][0] - map[i][1]);
}
cout << (result == 0 ? "Possible\n" : "Impossible\n");
}
return 0;
}