a224.
明明愛明明
| From: [140.135.52.61] |
發表日期
:
2012-01-01 01:04
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <ctype.h>
int main( int argc, char*argv[] ) {
char ch[1000] = "";
int counter[1000] = { 0 };
char str[1000] = "";
bool find = false;
int i = 0, j = 0, k = 0;
while( scanf( "%s", str ) != EOF ) {
for( i = 0 ; str[i] != '\0' ; i++ ) {
if( !isalpha( str[i] ) ) continue; // 去除非英文字母字元
if( isupper( str[i] ) ) str[i] = str[i] + 32; // 大寫轉小寫
for( j = 0 ; ch[j] != '\0' ; j++ ) { // 把str裡的英文字母存進ch裡
if( ch[j] == str[i] ) { // ch裡已有同樣字母時,就把對應的counter加1
counter[j]++; // 若沒有相同字母,則加在ch的最後面,對應counter加1
find = true;
} // if
} // for
if( find == false ) {
ch[j] = str[i];
counter[j]++;
ch[j+1] = '\0';
} // if
find = false;
} // for
for( i = 0 ; ch[i] != '\0' ; i++ ) {
if( ( counter[i] % 2 ) != 0 ) k++; // counter裡是奇數時,k加1
} // for // k用來記共有幾個奇數
if( k > 1 ) printf( "no...\n" );
else printf( "yes !\n" );
k = 0; // 初始化
ch[0] = '\0';
for( i = 0 ; i < 1000 ; i++ ) counter[i] = 0;
} // while
return 0;
} // main()