aboutsummaryrefslogtreecommitdiff
path: root/challenge-140/abigail/go/ch-1.go
blob: c355358d161842dd0a7847688a2b0a169fcb21dc (plain)
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
32
package main

//
// See ../README.md
//

//
// Run as: go run ch-1.go
//

import (
    "fmt"
    "bufio"
    "os"
    "strconv"
    "strings"
)

func main () {
    var reader = bufio . NewReader (os. Stdin)
    for {
        var text, err = reader . ReadString ('\n')
        if (err != nil) {
            break
        }
        bins := strings . Split (strings . Trim (text, "\n"), " ")
        a, _ := strconv . ParseInt (bins [0], 2, 0) 
        b, _ := strconv . ParseInt (bins [1], 2, 0) 
        
        fmt . Println (strconv . FormatInt (a + b, 2))
    }
}