From 245c0f0785111d1f8bd98979230ff22d1d421d1c Mon Sep 17 00:00:00 2001 From: zainabdnaya Date: Mon, 20 Jun 2022 23:01:42 +0100 Subject: [PATCH] Unzipstring function --- subjects/unzipstring/README.md | 61 ++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 subjects/unzipstring/README.md diff --git a/subjects/unzipstring/README.md b/subjects/unzipstring/README.md new file mode 100644 index 000000000..414dc930d --- /dev/null +++ b/subjects/unzipstring/README.md @@ -0,0 +1,61 @@ +## Unzipstring + + +### Instructions + +Unzipstring is a simple function that takes a string in of form of a number and an alphabet like (2a) and returns the original string (aa). + +- 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 + +```go +func Unzipstring(s string) string { + //code here +} +``` + +### Usage + +Here is a possible program to test your function: + +```go + +package main + +import ( + "fmt" + "piscine" +) + +func main() { + fmt.Println(piscine.Unzipstring("6H8a")) + fmt.Println(piscine.Unzipstring("3p6i1W")) + fmt.Println(piscine.Unzipstring("2O5u2H0e")) + fmt.Println(piscine.Unzipstring("2f")) + fmt.Println(piscine.Unzipstring("2a 6p8f")) + fmt.Println(piscine.Unzipstring("2p4;7g")) + fmt.Println(piscine.Unzipstring("2t4dD")) + fmt.Println(piscine.Unzipstring("82t4D")) + +} +``` + +And its output : + +```console +$ go run . +HHHHHaaaaaaaa +pppiiiiiiWWW +OOuuuuuHH +ff +Invalid Input +Invalid Input +Invalid Input +Invalid Input + +```