We know the tr command allows you to replace or translate characters in of a stream. It takes in two arguments - a set of characters to be replaced and a set of replacement characters. The full functionality of the command can be found using man tr, but this problem only requires a basic implementation capable of solving the examples below.
Write a program that implements basic tr functionality. Your program should take two arguments - the set of characters to be replaced and a set of replacement characters. It should then read lines of input from the standard in until EOF and translate them as shown in examples below.
Example 1
$ ./tr abc def
Input
abc aabbcc aaabbbccc
Output
def ddeeff dddeeefff
Example 2
$ ./tr xy XY
Input
xxyyxx
Lorem ipsum dolor sit amet
xxyyxx
Output
XXYYXX
Lorem ipsum dolor sit amet
XXYYXX
I am a long time programmer with large experience in many domains and languages (C/C++ are still my favorites). I also need a chance to start building a 'career' over here. Thanks.
$10 AUD 0 päivässä
5,0 (2 arvostelua)
0,2
0,2
5 freelancerit tarjoavat keskimäärin $24 AUD tätä projektia