Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Go
Checking the sample code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
// import "os"
import "fmt"
// import "bufio"
import "strconv"
func main() {
// scanner := bufio.NewScanner(os.Stdin)
// scanner.Buffer(make([]byte, 1000000), 1000000)
// scanner.Scan()
// m := scanner.Text()
m := "CG"
var c [2]string
c[0] = "00"
c[1] = "0"
var b = ""
for i := 0; i < len(m); i++ {
b += fmt.Sprintf("%07s", strconv.FormatInt(int64(m[i]), 2))
}
var a = ""
a += c[int(b[0]) - int('0')] + " 0"
for i := 1; i < len(b); i++ {
if b[i] == b[i - 1] {
a += "0"
} else {
a += " " + c[int(b[i]) - int('0')] + " 0"
}
}
// fmt.Fprintln(os.Stderr, "Debug messages...")
fmt.Println(a)
}
Enter to Rename, Shift+Enter to Preview
Looking at the syntax
- TODO
Other characteristics
- TODO
Resources to check
Coming next...
Suggested playgrounds
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content