This is simpler and less error prone. Just compare right->ch and if it doesn't match, check if next left is the last left.