Cut #3 – HackerRank Solution

In this post, we will solve Cut #3 HackerRank Solution. This problem (Cut #3) is a part of Linux Shell series.

Task

Display a range of characters starting at the 2nd position of a string and ending at the 7th position (both positions included).

Input Format

A text file containing N lines of ASCII text only.

Constraints

  • 1 <= N <= 100

Output Format

The output should contain N lines.
Each line should contain the range of characters starting at the 2nd position of a string and ending at the 7th position (both positions included).

Sample Input

Hello
World
how are you

Sample Output

ello
orld
ow are

Solution – Cut #3 – HackerRank Solution

# Display a range of characters starting at the 2nd position of a string and ending at the 7th position (both positions included)
cut -c 2-7

Note: This problem (Cut #3) is generated by HackerRank but the solution is provided by CodingBroz. This tutorial is only for Educational and Learning purpose.

Leave a Comment

Your email address will not be published. Required fields are marked *