Hdoj 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): 37878 accepted submission (s): 15559



The Problem description counts the number of times each vowel appears in a string.
 
Input data first contains an integer N, indicating the number of test instances, followed by a string of N rows with a length not greater than 100.
 
Output outputs 5 rows for each test instance in the following format:
A: num1
E: num2
I: num3
O: num4
U: num5
Multiple test instances are separated by one blank line.

Note: There are no blank lines after the last output :)
 
Sample Input
2aeioumy name is ignatius
 
Sample output
a:1e:1i:1o:1u:1a:2e:1i:3o:0u:1
 
Authorlcy
Sourcec language programming exercises (4)
Recommendlcy | we have carefully selected several similar problems for you: 2031 2032 2030 2028



Still have questions. Well, pay attention to PE problems.

#include <iostream>using namespace std;int main(){int n;char a[105];cin >> n;getchar();while (n--){gets(a);int b[5] = { 0 };for (int i = 0; i < strlen(a); i++){if (a[i] == 'a')b[0]++;else if (a[i] == 'e')b[1]++;else if (a[i] == 'i')b[2]++;else if (a[i] == 'o')b[3]++;else if (a[i] == 'u')b[4]++;}cout << "a:" << b[0] << endl;cout << "e:" << b[1] << endl;cout << "i:" << b[2] << endl;cout << "o:" << b[3] << endl;cout << "u:" << b[4] << endl;if (n!=0)cout << endl;}cin >> a;return 0;}


Hdoj 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.