statistical vowels
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others) total submission (s): 58391 Accepted Submission (s): 23254
problem Descriptioncounts the number of occurrences of each vowel letter in a string. InputThe input data first includes an integer n, which indicates the number of test instances, followed by a string of n lines with a length of not more than 100. Outputfor each test instance output 5 rows, the format is as follows: A:num1 e:num2 i:num3 o:num4 u:num5 Multiple test instances are separated by a blank line.
Please pay special attention: There is no blank line after the last output:) Sample Input2AeiouMy name is Ignatius Sample Outputa:1e:1i:1o:1u:1a:2e:1I:3o:0u:1
1#include <stdio.h>2#include <string.h>3 intMain () {4 inttest;5 intNum_a,num_e,num_i,num_o,num_u; 6scanf"%d", &test);7GetChar ();//In particular, use a getchar to eat the carriage return after entering the number of test groups, preventing the carriage return as a string when you use the Gets or getline.8 while(test--){9num_a=num_e=num_i=num_o=num_u=0;Ten Chars[101]; One gets (s); A intLen =strlen (s); - for(inti =0; i < Len; i++){ - Switch(S[i]) { the Case 'a': num_a++; Break; - Case 'e': num_e++; Break; - Case 'I': num_i++; Break; - Case 'o': num_o++; Break; + Case 'u': num_u++; Break; - } + } Aprintf"a:%d\ne:%d\ni:%d\no:%d\nu:%d\n", Num_a,num_e,num_i,num_o,num_u); at if(test) { -printf"\ n"); - } - - } - return 0; in}
HDU 2027 statistical vowels