I am trying to make a function to detect how many digits, letter, spaces, and others for a string.
Here\'s what I have so far:
def count(x):
leng
INPUT :
1
26
sadw96aeafae4awdw2 wd100awd
import re
a=int(input())
for i in range(a):
b=int(input())
c=input()
w=re.findall(r'\d',c)
x=re.findall(r'\d+',c)
y=re.findall(r'\s+',c)
z=re.findall(r'.',c)
print(len(x))
print(len(y))
print(len(z)-len(y)-len(w))
OUTPUT :
4
1
19
The four digits are 96, 4, 2, 100 The number of spaces = 1 number of letters = 19