Given a string containing multiple words, count the characters in each word and display them.
Example 1:
Input:
S = "the quick brown fox"
Output: 3 5 5 3
Explanation: "the" has 3 characters
"quick" has 5 characters
"brown" has 5 characters
"fox" has 3 characters
Ã¢â¬â¹Example 2:
Input: 
S = "geeks for geeks"
Output: 5 3 5
Explanation: "geeks" has 5 characters
"for" has 3 characters
"geeks" has 5 characters
Your Task:
You don't need to read input or print anything. Your task is to complete the function countChars() which takes the string S as inputs are returns an array containing the number of characters in each word of the string in the order as they appear in the input string S.
Expected Time Complexity: O(|S|).
Expected Auxiliary Space: O(|S|) (for output).
Constraints:
1 <= |S| <= 10^{5}

Difficulty: EASY
Tags: String algorithms

Data structures
Skill types: Data structures
Expected Time Complexity: O(|S|).
Expected Auxiliary Space: O(|S|) (for output).

Starter code:
#User function Template for python3

class Solution:
    def countChars(self,s):
        # code here 


Solutions:
class Solution:

	def countChars(self, s):
		return [len(i) for i in s.split()]


class Solution:

	def countChars(self, s):
		count = 0
		lp = []
		for i in s:
			if i != ' ':
				count += 1
			elif i == ' ':
				lp.append(count)
				count = 0
		lp.append(count)
		return lp


class Solution:

	def countChars(self, s):
		b = []
		s = s.split(' ')
		d1 = 0
		for i in s:
			for j in i:
				d1 += 1
			b.append(d1)
			d1 = 0
		return b


class Solution:

	def countChars(self, s):
		a = s.split()
		b = []
		for i in a:
			b.append(len(i))
		return b


class Solution:

	def countChars(self, s):
		return list(map(len, s.split()))


class Solution:

	def countChars(self, s):
		w = s.split()
		l = []
		for i in w:
			k = len(i)
			l.append(k)
		return l


class Solution:

	def countChars(self, s):
		return [len(e) for e in s.split()]


class Solution:

	def countChars(self, s):
		li = []
		ans = s.split()
		for i in ans:
			li.append(len(i))
		return li


class Solution:

	def countChars(self, s):
		l = s.split()
		d = []
		for i in range(0, len(l)):
			d.append(len(l[i]))
		return d


class Solution:

	def countChars(self, s):
		st = s.split()
		v = []
		for i in st:
			v.append(len(i))
		return v


class Solution:

	def countChars(self, s):
		l = s.split()
		r = []
		for i in l:
			r.append(len(i))
		return r


class Solution:

	def countChars(self, s):
		k = s.split()
		c = []
		for i in k:
			c.append(len(i))
		return c


class Solution:

	def countChars(self, s):
		l = []
		c = 0
		for i in s:
			if i != ' ':
				c += 1
			else:
				l.append(c)
				c = 0
		l.append(c)
		return l


class Solution:

	def countChars(self, s):
		return [len(j) for j in s.split()]


class Solution:

	def countChars(self, s):
		lst = list(s.split(' '))
		l1 = []
		for i in range(len(lst)):
			l1.append(len(lst[i]))
		return l1


class Solution:

	def countChars(self, s):
		ss = []
		s1 = s.split()
		for x in s1:
			ss.append(len(x))
		return ss


class Solution:

	def countChars(self, s):
		output = []
		words = s.split(' ')
		for word in words:
			count = len(word)
			output.append(count)
		return output


class Solution:

	def countChars(self, s):
		n = list(map(str, s.split(' ')))
		ans = []
		for i in n:
			ans.append(len(i))
		return ans


class Solution:

	def countChars(self, s):
		return [len(item) for item in s.split()]


class Solution:

	def countChars(self, s):
		arr = []
		count = 0
		for i in s:
			if i != ' ':
				count += 1
			else:
				arr.append(count)
				count = 0
		arr.append(count)
		return arr


class Solution:

	def countChars(self, s):
		cnt = 0
		ans = []
		for i in s:
			if i != ' ':
				cnt += 1
			else:
				ans.append(cnt)
				cnt = 0
		ans.append(cnt)
		return ans


class Solution:

	def countChars(self, s):
		res = []
		words = s.split(' ')
		for word in words:
			res.append(len(word))
		return res


class Solution:

	def countChars(self, s):
		s1 = []
		T = s.split()
		for x in T:
			count1 = len(x)
			s1.append(count1)
		return s1


class Solution:

	def countChars(self, s):
		g = s.split()
		j = []
		for i in g:
			j.append(len(i))
		return j


class Solution:

	def countChars(self, s):
		lis = s.split(' ')
		st = ''
		lis1 = []
		for i in lis:
			lis1.append(len(i))
		return lis1


class Solution:

	def countChars(self, s):
		arr = s.split(' ')
		ans = []
		for v in arr:
			ans.append(len(v))
		return ans


class Solution:

	def countChars(self, s):
		S = s.split()
		x = []
		for i in S:
			x.append(len(i))
		return x


class Solution:

	def countChars(self, s):
		s2 = s + '1z'
		s1 = s2.replace('1', ' ')
		c = 0
		a = []
		for i in range(len(s1)):
			c = c + 1
			if s1[i] == ' ':
				c = c - 1
				a.append(c)
				c = 0
		return a


class Solution:

	def countChars(self, s):
		a = s.split(' ')
		lst = []
		for i in a:
			if i == ' ':
				continue
			else:
				lst.append(len(i))
		return lst


class Solution:

	def countChars(self, s):
		l = []
		b = list(s.split())
		for j in b:
			l.append(len(j))
		return l


class Solution:

	def countChars(self, s):
		temp = 0
		a = []
		for i in s:
			if i == ' ':
				a.append(temp)
				temp = 0
			else:
				temp += 1
		a.append(temp)
		return a


class Solution:

	def countChars(self, s):
		S = s.split()
		n = []
		for x in S:
			s1 = len(x)
			n.append(s1)
		return n


class Solution:

	def countChars(self, s):
		lst = s.split(' ')
		ans = [0] * len(lst)
		for i in range(0, len(lst)):
			ans[i] = len(lst[i])
		return ans


class Solution:

	def countChars(self, s):
		l = []
		count = 0
		for i in range(len(s)):
			if s[i] == ' ':
				l.append(count)
				count = 0
			else:
				count += 1
		l.append(count)
		return l


class Solution:

	def countChars(self, s):
		l1 = s.split()
		ans = []
		for s1 in l1:
			ans.append(len(s1))
		return ans


class Solution:

	def countChars(self, s):
		r = s.split()
		res = []
		for x in r:
			res.append(len(x))
		return res


class Solution:

	def countChars(self, s):
		a = []
		l = s.split(' ')
		for i in l:
			a.append(len(i))
		return a
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		s = input()
		ob = Solution()
		result = ob.countChars(s)
		for i in result:
			print(i, end=' ')
		print()


class Solution:

	def countChars(self, s):
		ans = []
		k = 0
		for i in s.strip():
			if i == ' ':
				ans.append(k)
				k = 0
				continue
			k += 1
		else:
			ans.append(k)
		return ans
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		s = input()
		ob = Solution()
		result = ob.countChars(s)
		for i in result:
			print(i, end=' ')
		print()