Computer Science, asked by eshagupta0107, 5 hours ago

Enter a string and count number of words in the given string​

Answers

Answered by mrgoodb62
2

Answer:

Get the string to count the total number of words.

Check if the string is empty or null then return 0.

Create a StringTokenizer with the given string passed as a parameter.

Count the total number of words in the given string using the countTokens() method.

Now, print the result.

Explanation:

I hope it's helpful for you

Answered by tirath123
3

Answer:

answer is given below step by step

Explanation:

n = input("enter your name:")

print(len(n))

it will count your string

Similar questions