Write a method that reverses the letters of each word in a sentence while keeping the words in their original order. Words are separated by single spaces. Return null for a null input and an empty string for an empty input.
Examples:
Input: 'hello world'
Output: 'olleh dlrow'
Input: 'abc def ghi'
Output: 'cba fed ihg'
Input: 'hello'
Output: 'olleh'
Apex Code Editor
Welcome to Lightning Challenge!
How It Works
- • Write your solution in the code editor
- • Connect your Salesforce org to test
- • Submit to check if your solution passes
- • Use hints if you get stuck
Contest Alert
🏆 #CodeEveryDay October 2026 (Oct 16–31)Sponsored by FLXBL
Contest runs October 16 - 31. Complete challenges to climb the leaderboard!
Prizes 1 & 2: Salesforce certification exam voucher — won by random drawing, where every point is a ticket. see all prizes
Only the 16 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.