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

A cube and the net for the cube are shown. What is the surface area of this cube?A.30 cm²  B.70 cm²  C.125 cm²  D.150 cm²
The 120$ repair bill included 48$ for parts and the rest for labor. what percent of the bill was for labor?
What is the amplitude, period, and phase shift of f(x) = -4 sin(2x + π) - 5?
Founded in 1967, ASEAN did little to foster economic cooperation until _______ proposed a free-trade area in 1991
What is a difference between cohesion and adhesion? A. Only adhesion is involved in transpiration pull. B. Only cohesion is involved in the moveme
which type of transformation does not produce a congruent image is it dilation or translation or rotation or reflection
Plz I need help with some Maths?
I was delivered by Abraham Lincoln at the dedication of a battlefield cemetery in Pennsylvania. What am I
In 1959, Mary Leakey discovered the bones of Zinj, a ___ ancestor of modern humans. A. premier B. preposterous C. pretentious D. primeval
By tradition, when does the presidential campaign begin? A. When a candidate is officially nominated at the national convention B. After a candidate has gained