In this post, we will solve Cut #1 HackerRank Solution. This problem (Cut #1) is a part of HackerRank Linux Shell series.
Task
Given N lines of input, print the 3rd character from each line as a new line of output. It is guaranteed that each of the n lines of input will have a 3rd character.
Input Format
A text file containing N lines of ASCII characters.
Constraints
- 1 <= N <= 100
Output Format
For each line of input, print its 3rd character on a new line for a total of N lines of output.
Sample Input
Hello
World
how are you
Sample Output
l
r
w
Solution – Cut #1 – HackerRank Solution
# print the 3rd character from each line as a new line of output. cut -c 3
Note: This problem (Cut #1) is generated by HackerRank but the Solution is provided by CodingBroz. This tutorial is only for Educational and Learning purpose.