Question one hundred and eleven: Statistical vowels

Source: Internet
Author: User

[Plain] Description
 
Counts the number of times each vowel appears in a string.
 
Input
 
The input data first includes an integer n, indicating the number of test instances, followed by a string of n rows with a length not greater than 100.
 
Output
 
Output 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
 
 
2
Aeiou
My name is ignatius
 
Sample Output
 
 
A: 1
E: 1
I: 1
O: 1
U: 1
 
A: 2
E: 1
I: 3
O: 0
U: 1

Description

Counts the number of times each vowel appears in a string.

Input

The input data first includes an integer n, indicating the number of test instances, followed by a string of n rows with a length not greater than 100.

Output

Output 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


2
Aeiou
My name is ignatius

Sample Output


A: 1
E: 1
I: 1
O: 1
U: 1

A: 2
E: 1
I: 3
O: 0
U: 1
 


[Plain] # include <stdio. h>
# Include <string. h>
 
Int main ()
{
Int l;
Int;
Int e;
Int I;
Int o;
Int u;
Int num;
Int length;
Char string [101];
 
Scanf ("% d", & num );
Getchar ();
 
While (num --)
{
Gets (string );
 
Length = strlen (string );
A = e = I = o = u = 0;
 
For (l = 0; l <length; l ++)
{
If (string [l] = 'A' | string [l] = 'A ')
{
A ++;
}
Else if (string [l] = 'E' | string [l] = 'E ')
{
E ++;
}
Else if (string [l] = 'I' | string [l] = 'I ')
{
I ++;
}
Else if (string [l] = 'O' | string [l] = 'O ')
{
O ++;
}
Else if (string [l] = 'U' | string [l] = 'U ')
{
U ++;
}
}
 
Printf ("a: % d \ ne: % d \ ni: % d \ no: % d \ nu: % d", a, e, I, o, u );
If (num> 0)
{
Printf ("\ n ");
}
}
 
Return 0;
}

# Include <stdio. h>
# Include <string. h>

Int main ()
{
Int l;
Int;
Int e;
Int I;
Int o;
Int u;
Int num;
Int length;
Char string [101];

Scanf ("% d", & num );
Getchar ();

While (num --)
{
Gets (string );

Length = strlen (string );
A = e = I = o = u = 0;

For (l = 0; l <length; l ++)
{
If (string [l] = 'A' | string [l] = 'A ')
{
A ++;
}
Else if (string [l] = 'E' | string [l] = 'E ')
{
E ++;
}
Else if (string [l] = 'I' | string [l] = 'I ')
{
I ++;
}
Else if (string [l] = 'O' | string [l] = 'O ')
{
O ++;
}
Else if (string [l] = 'U' | string [l] = 'U ')
{
U ++;
}
}

Printf ("a: % d \ ne: % d \ ni: % d \ no: % d \ nu: % d", a, e, I, o, u );
If (num> 0)
{
Printf ("\ n ");
}
}

Return 0;
}
 

 



 

Related Article

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.