/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.nplusc.hhn;

/**
 *
 * @author LH
 */
public class TriZip
{
    public static void main(String[] args)
    {
        String a = "AAAAAA";
        String b = "BBBBBBBBBBBBBBBB";
        String c = "CCCCCCCC";
        
        System.out.println(a+"\n"+b+"\n"+c+"\n"+zip3(a,b,c));
        
        
        //System.out.println(zip3(a,b));
    }
    
    
    public static String zip3(String in1,String in2,String in3)
    {
        return //((in1.length()<2)&&(in2.length()<2))?in1+in2:zip(in1.substring(1),in2.substring(1));
                in1.length()<2?
                    in1+zip2(in2,in3):
                    in2.length()<2?
                        in1.substring(0,1)+in2+in3.substring(0,1)+zip2(in1.substring(1),in3.substring(1)):
                        in3.length()<2?
                            in1.substring(0,1)+in2.substring(0,1)+in3+zip2(in1.substring(1),in2.substring(1)):
                            in1.substring(0,1)+in2.substring(0,1)+in3.substring(0,1)+zip3(in1.substring(1),in2.substring(1),in3.substring(1));
                        
                        
    }
    
    public static String zip2(String in1,String in2)
    {
        return //((in1.length()<2)&&(in2.length()<2))?in1+in2:zip(in1.substring(1),in2.substring(1));
                in1.length()<2?
                    in1+in2:
                    in2.length()<2?
                        in1.substring(0,1)+in2+in1.substring(1):
                        in1.substring(0,1)+in2.substring(0,1)+zip2(in1.substring(1),in2.substring(1));
                        
    }
}
