#include <stdio.h>
#include <string.h>
int main() {
int N;
char str1[1001];
char str2[1001];
int alp[26];
scanf("%d",&N);
while (N--) {
//alp 0으로 초기화
memset(alp, 0, sizeof(alp));
int is_strfry=1;
scanf("%s %s",str1 ,str2);
//str1 alp 추가
for(int i=0; str1[i]!=0; i++) {
int idx=str1[i]-'a';
alp[idx]+=1;
}
//str2 alp 빼기
for(int i=0; str2[i]!=0; i++) {
int idx=str2[i]-'a';
alp[idx]-=1;
}
for (int i=0; i<26; i++) {
if (alp[i]!=0) {
is_strfry=0;
break;
}
}
if(is_strfry) {
printf("Possible\n");
} else {
printf("Impossible\n");
}
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: