Skip to content

Commit f6a0a1e

Browse files
committed
Count Alphabets
1 parent bb88e68 commit f6a0a1e

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""
2+
Problem Link: https://practice.geeksforgeeks.org/problems/count-alphabets/0
3+
4+
Given a string, print the number of alphabets present in the string.
5+
6+
Input:
7+
The first line of input contains an integer T denoting the number of test cases.
8+
The description of T test cases follows.Each test case contains a single string.
9+
10+
Output:
11+
Print the number of alphabets present in the string.
12+
13+
Constraints:
14+
1<=T<=30
15+
1<=size of string <=100
16+
17+
Example:
18+
Input:
19+
2
20+
adjfjh23
21+
njnfn_+-jf
22+
23+
Output:
24+
6
25+
7
26+
"""
27+
def count_alphabets(s):
28+
count = 0
29+
for c in s:
30+
if c.isalpha():
31+
count += 1
32+
return count
33+
34+
for _ in range(int(input())):
35+
s = input()
36+
print(count_alphabets(s))

0 commit comments

Comments
 (0)