First and Last Letter
InterviewTime limit1sMemory limit128 MB
Print the first and last letter of each given uppercase string, doubling the letter for length 1.
- Level
Easy1 of 10
- Topics
- String
- Solved
- No attempts yet
Problem
Write a program that reads a string and prints its first letter followed by its last letter.
Input
The first line contains the number of test cases (). Each of the next lines contains one string. Every string consists only of the uppercase letters A to Z, contains no spaces, and has length less than 1000.
Output
For each test case, print the first letter of the string immediately followed by its last letter, one test case per line. A string of length 1 has the same letter in both positions, so that letter is printed twice.