Create a component that finds the longest word in a hardcoded string and displays it.
HardProblem 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;
Input
The quick brown fox jumped over the lazy dog
Expected Output
Longest Word: jumped