a224.
明明愛明明
| From: [140.118.74.187] |
發表日期
:
2023-10-19 17:56
#include <stdio.h>
int main() {
char list[1001];
while (scanf("%s", list) != EOF) {
int times[26] = { 0 }; //代表26個英文出現的次數
int count = 0; //判斷奇數次出現次數
for (int i = 0; list[i] != '\0'; i++) {
int a = (int)list[i];
if (0 <= (a - 65) && (a - 65) <= 25) { //字母大寫時,判斷條件
times[a-65]++;
}
if (0 <= (a - 97) && (a - 97) <= 25) { //字母小寫時,判斷條件
times[a - 97]++;
}
}
for (int i = 0; i <= 25; i++) {
if (times[i] % 2 == 1) count++;
}
count <= 1 ? printf("yes !\n") : printf("no...\n");
}
return 0;
}
有問題,麻煩跟我說,謝謝您