[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;
}