X25R4HIACPHAGJBYF7QYHD3D3WMYONDBVXP6P6GNSASMUXOWYOCAC
// Package brackets finds matching brackets.
package brackets
func Bracket(input string) bool {
var brackets string
for _, b := range input {
switch b {
case '(', '[', '{':
brackets += string(b)
case ')':
if len(brackets) == 0 || brackets[len(brackets)-1] != '(' {
return false
}
brackets = brackets[:len(brackets)-1]
case ']':
if len(brackets) == 0 || brackets[len(brackets)-1] != '[' {
return false
}
brackets = brackets[:len(brackets)-1]
case '}':
if len(brackets) == 0 || brackets[len(brackets)-1] != '{' {
return false
}
brackets = brackets[:len(brackets)-1]
}
}
if len(brackets) == 0 {
return true
}
return false
}