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.
1.2 KiB
1.2 KiB
Unzipstring
Instructions
write a function named Unzipstring
that takes a string in form of a number and printable character that is not a number and returns the original string.
- the number before the alphabet should be between 0 to 9
- The one alphabet after each number should be between a to z or A to Z
- it can be two numbers or two alphabets in a row
- if the Input string doesn't respect the format return
Invalid Input
Expected Function
func Unzipstring(s string) string {
//code here
}
Usage
Here is a possible program to test your function:
package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(piscine.Unzipstring("2f"))
fmt.Println(piscine.Unzipstring("2O5u2H0e"))
fmt.Println(piscine.Unzipstring("3p6i1W"))
fmt.Println(piscine.Unzipstring("6H8a"))
fmt.Println(piscine.Unzipstring("2p4;7g"))
fmt.Println(piscine.Unzipstring("2a 6p8f"))
fmt.Println(piscine.Unzipstring("2t4dD"))
fmt.Println(piscine.Unzipstring("82t4D"))
fmt.Println(piscine.Unzipstring(""))
}
And its output :
$ go run .
$ff
$OOuuuuuHH
$pppiiiiiiWWW
$HHHHHaaaaaaaa
$pp;;;;ggggggg
$Invalid Input
$Invalid Input
$Invalid Input
$Invalid Input