joinstr acc 0 (('{':x):xs) | last x == '}' = joinstr (('{':x):acc) 0 xs
                           | otherwise     = joinstr (('{':x):acc) 1 xs
joinstr acc 0 (('{':x):xs) | last x == '}' = joinstr (('{':x):acc) 0 xs
                           | otherwise     = joinstr (('{':x):acc) 1 xs
joinstr acc 0 (('{':x):xs) | last x == '}' = joinstr (('{':x):acc) 0 xs
                           | otherwise     = joinstr (('{':x):acc) 1 xs