Programming Exercises

Create a component that finds the longest word in a hardcoded string and displays it.

Hard

Problem Statement

Create a component that finds the longest word in a hardcoded string and displays it.

Sample Input

The quick brown fox jumped over the lazy dog

Sample Output

Longest Word: jumped

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
import React from "react"; const LongestWord = () => { return ( <div> {/* Display the longest word */} </div> ); }; export default LongestWord;
Log in or sign up to run or submit your code.Log inSign up
Input
The quick brown fox jumped over the lazy dog
Expected Output
Longest Word: jumped