HDU 2027 statistical vowels

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.