0
PlzzzzzzzI have a doubt on this prblm Write a program to read a string strstr, which will contain words separated with space.
Write a program to read a string strstr, which will contain words separated with space. Your task is to count the length of each word and print it. The output should be comma separated string. Each string strstr will begin with "@". The code stub provided here is to be used. It calls the function countChar(). Your task is to complete the function. Input: First line will contain TT, number of testcases. Then the testcases follow. Each testcase contains a single string strstr Output For each testcase, print the output on new line.
7 Réponses
+ 3
#try this
t=int(input())
for i in range(t):
str=input().split("@")
for i in str:
print(i)
+ 2
Here you go!
t=int(input())
for i in range(t):
str=input().split("@")
for i in str:
print(len(i),end="," if i != str[-1] else "")
+ 1
That problm statement I solve but
see:
t=int(input())
for i in range(t):
str=input().split()
for i in str:
l=len(i)
print(l,end=",")
+ 1
I really thanks ❤from my heart
to help me in solving this question
Thank u
0
but i don't able to find @ condition and also, comma at last of my ans
0
yeah it absolutely right
but, I need to get len() of each word seperated with comma
but i get comma at end also
How to remove that comma
#try this
t=int(input())
for i in range(t):
str=input().split("@")
for i in str:
print(len(i),end=",")
If I remove the end="," Then I don't get commas in between that len() of i
0
G-5256 Can you tell me your problem in brief?
i am unable to understand it.