Computer Science
Write a program to input a line of text and print the biggest word (length wise) from it.
Python
Python String Manipulation
28 Likes
Answer
str = input("Enter a string: ")
words = str.split()
longWord = ''
for w in words :
if len(w) > len(longWord) :
longWord = w
print("Longest Word =", longWord)
Output
Enter a string: TATA FOOTBALL ACADEMY WILL PLAY AGAINST MOHAN BAGAN
Longest Word = FOOTBALL
Answered By
13 Likes
Related Questions
Write a program that asks the user for a string (only single space between words) and returns an estimate of how many words are in the string. (Hint. Count number of spaces)
Write a program that inputs a line of text and prints out the count of vowels in it.
Write a program to input a formula with some brackets and checks, and prints out if the formula has the same number of opening and closing parentheses.
Write a program to input a line of text and create a new line of text where each word of input line is reversed.