Last and Second-Last

Problem Overview

  • Create a new string from the input's last two letters, reversed and separated by a space.
  • Input: word (length 2–100). Output: two characters with a space between them.
  • Relates to basic string manipulation in text processing and data cleanup.
  • From Oracle interviews; a classic coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: