โ† IBM questions

Length of last word in a string

Filed under IBM

Given a string s consisting of words and spaces, return the length of the last word in the string. A word is maximal substring consisting of non-space characters only.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related IBM questions

Collected from public candidate posts and coding forums. Updated Nov 2026.