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

Programming Exercises

Find the length of the longest word in a sentence

Easy

Problem Statement

Find the length of the longest word in a sentence

Sample Input

Java programming is fun

Sample Output

11

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
public class Main { public static int longestWordLength() { String sentence = "Java programming is fun"; // Your code here return 0; } }
Log in or sign up to run or submit your code.Log inSign up
Input
Java programming is fun
Expected Output
11