'Tr' Command #3, is a HackerRank problem from Text Processing subdomain. In this post we will see how we can solve this challenge in Sh

Problem Description

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' ....

You can find the full details of the problem 'Tr' Command #3 at HackerRank

Solution: Please check the tr-3.sh snippet for the solution.

This solution originally posted at: Github by @srgnk