Added solutions for 8th day : the seven segments code to guess
This commit is contained in:
parent
19d312c0fb
commit
984d3d5ebb
4 changed files with 378 additions and 0 deletions
25
2021/08/first.go
Normal file
25
2021/08/first.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
score := 0
|
||||
|
||||
s := bufio.NewScanner(os.Stdin)
|
||||
for s.Scan() {
|
||||
inputs := strings.Split(s.Text(), " | ")
|
||||
output := strings.Split(inputs[1], " ")
|
||||
for _, v := range output {
|
||||
l := len(v)
|
||||
if l < 5 || l == 7 {
|
||||
score++
|
||||
}
|
||||
}
|
||||
}
|
||||
fmt.Println(score)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue