Given a number N and the task is to print the first and last digit of N.
Input:
The first line of the input contains a single integer T, denoting the number of test cases. Then T test case follows, a single line of the input containing a positive integer N.
Output:
For each testcase, print a single line containing the first and last digit of N respectively.
Constraints:
1<=T<=100
1<=N<=100000
Example:
Input:
2
12345
98562
Output:
1 5
9 2
Explanation:
For testcase 1: First digit of 12345 is 1 and last is 5.
For testcase 2: First digit of 98562 is 9 and last is 2.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.
preparecodinginterview_dot_com | 190 |
__murugan__ | 171 |
manvimahajan20 | 134 |
ShameekAgarwal | 116 |
SoumyaKaushik | 108 |
preparecodinginterview_dot_com | 190 |
__murugan__ | 171 |
manvimahajan20 | 160 |
SoumyaKaushik | 146 |
arpit_anshuman | 140 |
blackshadows | 5331 |
Ibrahim Nash | 5219 |
akhayrutdinov | 5111 |
mb1973 | 4929 |
Quandray | 4567 |