PlzzzzzzzI have a doubt on this prblm Write a program to read a string strstr, which will contain words separated with space. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

17th Oct 2021, 7:22 AM
G-5256
G-5256 - avatar
7 Answers
+ 3
#try this t=int(input()) for i in range(t): str=input().split("@") for i in str: print(i)
17th Oct 2021, 7:42 AM
Simba
Simba - avatar
+ 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 "")
17th Oct 2021, 10:17 AM
Simba
Simba - avatar
+ 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=",")
17th Oct 2021, 7:35 AM
G-5256
G-5256 - avatar
+ 1
I really thanks ❤from my heart to help me in solving this question Thank u
17th Oct 2021, 2:51 PM
G-5256
G-5256 - avatar
0
but i don't able to find @ condition and also, comma at last of my ans
17th Oct 2021, 7:36 AM
G-5256
G-5256 - avatar
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
17th Oct 2021, 7:50 AM
G-5256
G-5256 - avatar
0
G-5256 Can you tell me your problem in brief? i am unable to understand it.
17th Oct 2021, 5:15 PM
Sagar Yadav
Sagar Yadav - avatar