public/subjects/repeatalpha
xpetit 46f4ddc49e
Simplify prompt, execution of Go programs, fix typos
2021-04-28 11:47:34 +02:00
..
README.md Simplify prompt, execution of Go programs, fix typos 2021-04-28 11:47:34 +02:00

README.md

repeatalpha

Instructions

Write a program called repeat_alpha that takes a string and displays it repeating each alphabetical character as many times as its alphabetical index.

The result must be followed by a newline ('\n').

'a' becomes 'a', 'b' becomes 'bb', 'e' becomes 'eeeee', etc...

If the number of arguments is different from 1, the program displays nothing.

Usage

$ go run . abc | cat -e
abbccc
$ go run . Choumi. | cat -e
CCChhhhhhhhooooooooooooooouuuuuuuuuuuuuuuuuuuuummmmmmmmmmmmmiiiiiiiii.$
$ go run . "abacadaba 01!" | cat -e
abbacccaddddabba 01!$
$ go run .
$ go run . "" | cat -e
$
$