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.
31 lines
898 B
31 lines
898 B
6 years ago
|
## repeatalpha
|
||
6 years ago
|
|
||
6 years ago
|
### Instructions
|
||
6 years ago
|
|
||
|
Write a program called repeat_alpha that takes a string and display it
|
||
|
repeating each alphabetical character as many times as its alphabetical index,
|
||
|
followed by a newline.
|
||
|
|
||
6 years ago
|
`'a'` becomes `'a'`, `'b'` becomes `'bb'`, `'e'` becomes `'eeeee'`, etc...
|
||
6 years ago
|
|
||
|
Case remains unchanged.
|
||
|
|
||
|
If the number of arguments is not 1, just display a newline.
|
||
|
|
||
|
Examples:
|
||
|
|
||
|
```console
|
||
|
student@ubuntu:~/student/repeatalpha$ go build
|
||
|
student@ubuntu:~/student/repeatalpha$ ./repeatalpha "abc" | cat -e
|
||
|
abbccc
|
||
|
student@ubuntu:~/student/repeatalpha$ ./repeatalpha "Alex." | cat -e
|
||
|
Alllllllllllleeeeexxxxxxxxxxxxxxxxxxxxxxxx.$
|
||
|
student@ubuntu:~/student/repeatalpha$ ./repeatalpha "abacadaba 42!" | cat -e
|
||
|
abbacccaddddabba 42!$
|
||
|
student@ubuntu:~/student/repeatalpha$ ./repeatalpha | cat -e
|
||
|
$
|
||
|
student@ubuntu:~/student/repeatalpha$ ./repeatalpha "" | cat -e
|
||
|
$
|
||
6 years ago
|
student@ubuntu:~/student/repeatalpha$
|
||
6 years ago
|
```
|