solve the zigzag Conversion