/***********************************************************************
「kadai069」
文字列を入力し、その種類と、個数を表示する
作成日:2011/02/23
************************************************************************/
#include <stdio.h>
main(){
char a[5000+1];
int i;
int j;
int cnt;
int c;
int len;
scanf("%s",&a[0]);
i = 0;
cnt =0;
c = 0;
len = 0;
while(a[len]){
len++;
}
while(a[i]){
for(j=0 ; j<i ; j++){
if(a[j] == a[i]){
break;
}
}
if(j == i){
cnt++;
for(j=0 ; j<=len ; j++){
if(a[j] == a[i]){
c++;
}
}
printf("%c文字、%d個です\n",a[i],c);
c = 0;
}
i++;
}
}
本当は処理と結果は分けたかったのだけど途中表示です。。。
|

- >
- Yahoo!サービス
- >
- Yahoo!ブログ
- >
- 練習用





