Skip to content

Commit ccc77b2

Browse files
committed
Algorithms: Searching
1 parent ab2e0a6 commit ccc77b2

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Today, Monk went for a walk in a garden. There are many trees in the garden and each tree has an English alphabet on
2+
# it. While Monk was walking, he noticed that all trees with vowels on it are not in good state. He decided to take care
3+
# of them. So, he asked you to tell him the count of such trees in the garden.
4+
# Note : The following letters are vowels: 'A', 'E', 'I', 'O', 'U' ,'a','e','i','o' and 'u'.
5+
#
6+
# Input:
7+
# The first line consists of an integer T denoting the number of test cases.
8+
# Each test case consists of only one string, each character of string denoting the alphabet (may be lowercase or
9+
# uppercase) on a tree in the garden.
10+
#
11+
# Output:
12+
# For each test case, print the count in a new line.
13+
#
14+
# Constraints:
15+
# 1≤T≤10
16+
# 1≤length of string≤105
17+
#
18+
# SAMPLE INPUT
19+
# 2
20+
# nBBZLaosnm
21+
# JHkIsnZtTL
22+
#
23+
# SAMPLE OUTPUT
24+
# 2
25+
# 1
26+
#
27+
# Explanation
28+
# In test case 1, a and o are the only vowels. So, count=2
29+
30+
for _ in range(int(input())):
31+
count = 0
32+
string = input().lower()
33+
for i in string:
34+
if i in ['a', 'e', 'i', 'o', 'u']:
35+
count += 1
36+
37+
print(count)

0 commit comments

Comments
 (0)