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.
804 B
804 B
repeatalpha
Instructions
Write a function called RepeatAlpha
that takes a string
and displays it repeating each alphabetical character as many times as its alphabetical index.
'a'
becomes 'a'
, 'b'
becomes 'bb'
, 'e'
becomes 'eeeee'
, etc...
Expected Function
func RepeatAlpha(s string) string {
}
Usage
Here is a possible program to test your function:
package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(piscine.RepeatAlpha("abc"))
fmt.Println(piscine.RepeatAlpha("Choumi."))
fmt.Println(piscine.RepeatAlpha(""))
fmt.Println(piscine.RepeatAlpha("abacadaba 01!"))
}
And its output:
$ go run . | cat -e
abbccc$
CCChhhhhhhhooooooooooooooouuuuuuuuuuuuuuuuuuuuummmmmmmmmmmmmiiiiiiiii.$
$
abbacccaddddabba 01!$
$