Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MinSomai/1d0f38ec78ad633c255e0ccb994cd65d to your computer and use it in GitHub Desktop.
Save MinSomai/1d0f38ec78ad633c255e0ccb994cd65d to your computer and use it in GitHub Desktop.
Day 6 : Golang | Let's Review - Hackerrank.go
package main
import (
"fmt"
"bufio"
"os"
"strings"
)
func main() {
//Enter your code here. Read input from STDIN. Print output to STDOUT
allInput := bufio.NewScanner(os.Stdin)
// ignore first input
allInput.Scan()
for allInput.Scan(){
inputValue := allInput.Text()
charSplice := strings.Split(inputValue, "")
var odd, even string
for index, eachChar := range charSplice{
if(index%2==0){
odd += eachChar
}else{
even += eachChar
}
}
fmt.Println(odd + " " + even)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment