mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
945 B
28 lines
945 B
5 years ago
|
## repeatalpha
|
||
5 years ago
|
|
||
5 years ago
|
### Instructions
|
||
![]()
5 years ago
|
|
||
![]()
4 years ago
|
Write a program called `repeat_alpha` that takes a `string` and displays it repeating each alphabetical character as many times as its alphabetical index.
|
||
5 years ago
|
|
||
![]()
5 years ago
|
The result must be followed by a newline (`'\n'`).
|
||
![]()
5 years ago
|
|
||
5 years ago
|
`'a'` becomes `'a'`, `'b'` becomes `'bb'`, `'e'` becomes `'eeeee'`, etc...
|
||
![]()
5 years ago
|
|
||
![]()
4 years ago
|
If the number of arguments is different from 1, the program displays nothing.
|
||
![]()
5 years ago
|
|
||
5 years ago
|
### Usage
|
||
![]()
5 years ago
|
|
||
|
```console
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/repeatalpha$ go build
|
||
![]()
4 years ago
|
student@ubuntu:~/[[ROOT]]/repeatalpha$ ./repeatalpha abc | cat -e
|
||
![]()
5 years ago
|
abbccc
|
||
![]()
4 years ago
|
student@ubuntu:~/[[ROOT]]/repeatalpha$ ./repeatalpha Choumi. | cat -e
|
||
![]()
5 years ago
|
CCChhhhhhhhooooooooooooooouuuuuuuuuuuuuuuuuuuuummmmmmmmmmmmmiiiiiiiii.$
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/repeatalpha$ ./repeatalpha "abacadaba 01!" | cat -e
|
||
![]()
5 years ago
|
abbacccaddddabba 01!$
|
||
![]()
4 years ago
|
student@ubuntu:~/[[ROOT]]/repeatalpha$ ./repeatalpha
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/repeatalpha$ ./repeatalpha "" | cat -e
|
||
![]()
5 years ago
|
$
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/repeatalpha$
|
||
![]()
5 years ago
|
```
|