+ 12
CHALLENGE : Finding the biggest word in a String !!!!
Write a program to input a sentence and print the biggest and the smallest word in the string . For example... Input : I love Coding Output : Smallest Word in The String: I Biggest Word in The String: Coding Any programming language you like... ! Good luck coders !!! :-)
13 Answers
+ 7
Thank you Everyone..
I am posting my favourite answers here...
https://code.sololearn.com/clxz7chJuX27/?ref=app
https://code.sololearn.com/c4ZoO883ZEmh/?ref=app
https://code.sololearn.com/cSr9bove5x1H/?ref=app
https://code.sololearn.com/ctiHEVd4Wrv4/?ref=app
https://code.sololearn.com/cWSizi6gcgrr/?ref=app
https://code.sololearn.com/cMc235zZi64u/?ref=app
https://code.sololearn.com/cois4kA80yNo/?ref=app
Well Done Everyone..
:)
PS : I'll post more codes here... if I like any other new answers !
+ 10
+ 10
https://code.sololearn.com/c4ZoO883ZEmh/?ref=app
+ 8
Hello! Here is my try in Python! :)
https://code.sololearn.com/clxz7chJuX27/?ref=app
+ 6
@Aaron.. Thank you! :)
+ 5
@Shinjini.. great code !
+ 3
I probably could have fitted it in one line, but that would have made a mess and it wouldn't be the Pythonic way, so here is my two-liner:
https://code.sololearn.com/cMc235zZi64u
+ 3
Here is your answer:
https://code.sololearn.com/ckn74zkY7kG4/?ref=app
+ 2
phrase=input("write a phrase")
x=phrase.split()
max=0
min=0
for i in x:
y=len(list(i))
if y>max:
max=y
long=i
if min==0:
min=y
elif y<min:
min=y
short=i
print("the longest word in your phrase is ",long)
print("the shortest word in your phrase is ",short)
+ 2
one line, just for fun
https://code.sololearn.com/ctiHEVd4Wrv4/?ref=app
+ 1
https://code.sololearn.com/cois4kA80yNo/?ref=app
This is my optimized solution in Java.
It also says when two words along the phrase have the same size or if all the words inserted have the same size.
I'm still working in some other cool features.