Created
June 30, 2016 13:11
-
-
Save dflima/b93161a50ff905c5e4e157859729d122 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func PrintEvenIndexes(array []byte) { | |
| for i := range array { | |
| if i % 2 == 0 { | |
| fmt.Printf("%s", string(array[i])) | |
| } | |
| } | |
| } | |
| func PrintOddIndexes(array []byte) { | |
| for i := range array { | |
| if i % 2 != 0 { | |
| fmt.Printf("%s", string(array[i])) | |
| } | |
| } | |
| } | |
| func main() { | |
| //Enter your code here. Read input from STDIN. Print output to STDOUT | |
| var size int | |
| var input string | |
| fmt.Scanf("%d", &size) | |
| for i := 0; i < size; i++ { | |
| fmt.Scanf("%v", &input) | |
| array := []byte(input) | |
| PrintEvenIndexes(array) | |
| fmt.Print(" ") | |
| PrintOddIndexes(array) | |
| fmt.Print("\n") | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment