‘Tr’ Command #3 HackerRank Solution

Hello coders, In this post, you will learn how to solve ‘Tr’ Command #3– HackerRank Solution. This problem is a part of the Linux Shell series.

‘Tr’ Command #3 HackerRank Solution
‘Tr’ Command #3 HackerRank Solution

‘Tr’ Command #3 HackerRank Solution

Problem

In a given fragment of text, replace all sequences of multiple spaces with just one space.

Input Format

A block of ASCII text.

Output Format

Replace all sequences of multiple spaces with just one space.

Sample Input

He llo
Wor ld
how are you

Sample Output

He llo
Wor ld
how are you

‘Tr’ Command #3 HackerRank Solution

#Replace all sequences of multiple spaces with just one space.
tr -s ' '

Note: This problem (‘Tr’ Command #3) is generated by HackerRank but the solution is provided by chase2learn. This tutorial is only for Learning and Educational purpose.

Sharing Is Caring