#include <stdio.h>
#define MAXLEN 80
int count_num(char *);
int count_up(char *);
int count_low(char *);
int main(void){
char string[MAXLEN + 1];
printf("文字列を入力してください : ");
scanf("%80s", string);
printf("文字列に含まれる数字の数%d", count_num);
printf("文字列に含まれる大文字の数%d", count_up);
printf("文字列に含まれる小文字の数%d", count_low);
return(0);
}
int count_num(char *str){
int count = 0;
for( ; *str != '\0'; str++){
if((*str >= '0') && (*str <= '9')){
count++;
}
}
return(count);
}
int count_up(char *str){
int count = 0;
for( ; *str != '\0'; str++){
if((*str >= 'A') && (*str <= 'Z')){
count++;
}
}
return(count);
}
int count_low(char *str){
int count = 0;
for( ; *str != '\0'; str++){
if((*str >= 'a') && (*str <= 'z')){
count++;
}
}
return(count);
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgojZGVmaW5lIE1BWExFTiA4MAoKaW50IGNvdW50X251bShjaGFyICopOwppbnQgY291bnRfdXAoY2hhciAqKTsKaW50IGNvdW50X2xvdyhjaGFyICopOwoKaW50IG1haW4odm9pZCl7CgljaGFyIHN0cmluZ1tNQVhMRU4gKyAxXTsKCQoJcHJpbnRmKCLmloflrZfliJfjgpLlhaXlipvjgZfjgabjgY/jgaDjgZXjgYQgOiAiKTsKCXNjYW5mKCIlODBzIiwgc3RyaW5nKTsKCQoJcHJpbnRmKCLmloflrZfliJfjgavlkKvjgb7jgozjgovmlbDlrZfjga7mlbAlZCIsIGNvdW50X251bSk7CglwcmludGYoIuaWh+Wtl+WIl+OBq+WQq+OBvuOCjOOCi+Wkp+aWh+Wtl+OBruaVsCVkIiwgY291bnRfdXApOwoJcHJpbnRmKCLmloflrZfliJfjgavlkKvjgb7jgozjgovlsI/mloflrZfjga7mlbAlZCIsIGNvdW50X2xvdyk7CgkKCXJldHVybigwKTsKfQoKaW50IGNvdW50X251bShjaGFyICpzdHIpewoJaW50IGNvdW50ID0gMDsKCQoJZm9yKCA7ICpzdHIgIT0gJ1wwJzsgc3RyKyspewoJCWlmKCgqc3RyID49ICcwJykgJiYgKCpzdHIgPD0gJzknKSl7CgkJCWNvdW50Kys7CgkJfQoJfQoJCglyZXR1cm4oY291bnQpOwp9CgppbnQgY291bnRfdXAoY2hhciAqc3RyKXsKCWludCBjb3VudCA9IDA7CgkKCWZvciggOyAqc3RyICE9ICdcMCc7IHN0cisrKXsKCQlpZigoKnN0ciA+PSAnQScpICYmICgqc3RyIDw9ICdaJykpewoJCQljb3VudCsrOwoJCX0KCX0KCQoJcmV0dXJuKGNvdW50KTsKfQoKaW50IGNvdW50X2xvdyhjaGFyICpzdHIpewoJaW50IGNvdW50ID0gMDsKCQoJZm9yKCA7ICpzdHIgIT0gJ1wwJzsgc3RyKyspewoJCWlmKCgqc3RyID49ICdhJykgJiYgKCpzdHIgPD0gJ3onKSl7CgkJCWNvdW50Kys7CgkJfQoJfQoJCglyZXR1cm4oY291bnQpOwp9