-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathP01_CountNumbers.py
41 lines (39 loc) · 937 Bytes
/
P01_CountNumbers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Your task is pretty simple , given a string S , find the total count of numbers present in the digit.
#
# Input
#
# The first line contains T , the number of test cases. The first line of each and every testc ase will contain a integer N ,
# the length of the string . The second line of each and every test case will contain a string S of length N.
#
# Output
#
# For each and every testcase , output the total count of numbers present in the string.
#
# Constraints
#
# 0 < T < 200
#
# 0 < N < 10000
#
# SAMPLE INPUT
# 1
# 26
# sadw96aeafae4awdw2wd100awd
#
# SAMPLE OUTPUT
# 4
testCases = int(input())
while testCases:
testCases -= 1
N = int(input())
count = 0
result = 0
string = input()
for i in string:
if i.isdigit():
count += 1
else:
if count >= 1:
result += 1
count = 0
print(result)