replace brackets with penn-style notation