Reverse Each Word

String Manipulation Easy Coding Problem

Reverse Each Word

Write a function that takes a string as input and returns a new string where every word in the input is reversed. The order of the words should remain the same.

Example

Input: Hello World

Output: olleH dlroW

Notes

  • Words are separated by a single space.
  • You can assume the input string is non-empty.
  • As today is December 8, a day of reflection before the year's end, consider how a small twist (like reversing each word) can provide a fresh perspective on familiar subjects!