Write a program to find the largest and smallest word in given string...?
Smallest word: an
Largest word: extraordinary
str1="Hardships often prepare ordinary people for an extraordinary destiny"
SplitString=split(str1, " ")
For each x in SplitString
If len(x)=2 Then
Msgbox "Smallest word: "&x
elseif len(x)=12 then
Msgbox "Largest word: "&x
End If
Next
Output:
No comments:
Post a Comment
Note: only a member of this blog may post a comment.