第10课。

This commit is contained in:
unlockable
2022-11-25 23:41:25 +08:00
parent 605137a437
commit a37a95fbed
7 changed files with 188 additions and 0 deletions

36
10/Optional01.c Normal file
View 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;
}