#!/usr/local/bin/tcc -run #include #include int main( void ) { int ch, i; int cnt[26] = {0}; printf( "文字を入力しなさい(終了条件:Ctrl+Z)\n" ); while (( ch = getchar( )) != EOF ) { if (0 != isupper(ch)) { cnt[ch-'A']++; } else if (0 != islower(ch)) { cnt[ch-'a']++; } } /* 何個ずつ入力したか出力(2) */ for (i = 0;i < 26; i++) { printf( "%c : %3d個入力\t\t", 'a'+i, cnt[i] ); if (2 == i%3 ) putchar( '\n' ); } return 0; }