修改文件结构。
This commit is contained in:
36
POP/10/Optional01.c
Normal file
36
POP/10/Optional01.c
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
int main() {
|
||||
char str[2][26] = {0};
|
||||
int count[2][26] = {0};
|
||||
int i = 0, length = 0;
|
||||
bool same = true;
|
||||
scanf("%s", str[0]);
|
||||
scanf("%s", str[1]);
|
||||
if (strlen(str[0]) != strlen(str[1])) {
|
||||
printf("0");
|
||||
}
|
||||
else {
|
||||
length = strlen(str[0]);
|
||||
for (i = 0; i < length; i++) {
|
||||
count[0][str[0][i]%26]++;
|
||||
count[1][str[1][i]%26]++;
|
||||
}
|
||||
for (i = 0; i < 26; i++) {
|
||||
if (count[0][i] != count[1][i]) {
|
||||
same = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (same) {
|
||||
printf("1");
|
||||
}
|
||||
else {
|
||||
printf("0");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user