WXQGPQ43KQVFV4CHL4LFX57UNZ5AKS44IYIUOZHJN4MYSNOBY5WQC
}
func mendLine(input string) string {
var brackets string
for _, b := range input {
switch b {
case '(', '[', '{', '<':
brackets += string(b)
case ')', ']', '}', '>':
brackets = brackets[:len(brackets)-1]
}
}
ret := strings.Builder{}
for i := len(brackets) - 1; i >= 0; i-- {
var pair byte
switch brackets[i] {
case '(':
pair = ')'
case '{':
pair = '}'
case '[':
pair = ']'
case '<':
pair = '>'
default:
log.Panicln("invalid bracket")
}
ret.WriteByte(pair)
}
return ret.String()
func compScore(in string) int {
var ret int
for _, ch := range in {
ret *= 5
switch ch {
case ')':
ret += 1
case ']':
ret += 2
case '}':
ret += 3
case '>':
ret += 4
}
}
return ret
}