‘Tr’ Command #1 HackerRank Solution

Hello Programmers, In this post, you will know how to solve the ‘Tr’ Command #1 HackerRank Solution. This problem is a part of the HackerRank Linux Shell Series.

‘Tr’ Command #1 HackerRank Solution
‘Tr’ Command #1 HackerRank Solutions

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.


In this challenge, we practice using the tr command because it is a useful translation tool in Linux.

In a given fragment of text, replace all parentheses () with box brackets [].

Input Format

A block of ASCII text.

Output Format

Output the text with all parentheses () replaced with box brackets [].

Sample Input

int i=(int)5.8
(23 + 5)*2

Sample Output

int i=[int]5.8
[23 + 5]*2

‘Tr’ Command #1 HackerRank Solutions

#Output the text with all parentheses () replaced with box brackets [].
tr "()" "[]"

Note: This problem (‘Tr’ Command #1) is generated by HackerRank but the Solution is Provided by  BrokenProgrammers. This tutorial is only for Educational and Learning purposes.

Next: ‘Tr’ Command #2 HackerRank Solution

Leave a Reply

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