Description
Solutions
Last and Second-Last
🔥 FULLTIME📚RELATED PROBLEMS
Given a string, create a new string made up of its last two letters, reversed and separated by a space.
Function Description
Complete the function lastLetters
in the editor below.
lastLetters has the following parameter(s):
string word
: a string to process
Returns
string: a string of two space-separated characters
Example 1:
Input: word = "APPLE"
Output: "E L"
Explanation:The last letter in 'APPLE' is E and the second-to-last letter is L, so return E L.
Example 2:
Input: word = "bat"
Output: "t a"
Explanation:Just an example provided by Oracle with no explanation 🥲🔫
Constraints:
2 ≤ length of word ≤ 100

Related Problems
Testcase
Result
Case 1
input:
output: