triangle and encode string