Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a program to find the longest word in a sentence.

Medium

Problem Statement

Write a program to find the longest word in a sentence.

Sample Input

"Coding is a wonderful experience"

Sample Output

experience

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
// Find the longest word in a sentence function longestWord(sentence) { } console.log(longestWord("Coding is a wonderful experience"));
Log in or sign up to run or submit your code.Log inSign up
Input
"Coding is a wonderful experience"
Expected Output
experience