nia850
nia850 nia850
  • 21-09-2020
  • Computers and Technology
contestada

Create the code that will find
the longest word of the given
string. You are not allowed to
use split() method

(python)

Respuesta :

johnsong14306
johnsong14306 johnsong14306
  • 21-09-2020

Answer:

function findLongestWord(str) {

 var longestWord = str.split(' ').sort(function(a, b) { return b.length - a.length; });

 return longestWord[0].length;

}

findLongestWord(InputHere);

Explanation:

Replace InputHere with the input

Answer Link

Otras preguntas

how was the telegraph useful to people in the past?
17. The Niagara Movement, headed by _______, sought equal rights for blacks.
Exports of tin and silver were the mainstays of the _______ economy for many decades. However, today, as the market for tin has declined, the country has become
a large group of people is going to a baseball game. If 97 people are going and each bus holds 32 people. How many buses will need to be ordered?
How did Portuguese explorations affect the people of Africa and India
Corporations had the important advantage of reducing the financial risk for who?
Why was the outcome of the war important for American colonists
how do I do this problem 125 divided by 468.75 I keep getting a different answer
A(n) __________ is a microscopic organism that causes disease.A. infectionb.pathogenc.antigenD.antibody
how do you solve 9 - x = 10 using algebraic operations?