package vernam;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Random;

public class Main {

    static Random R;

  public static byte xor(byte a,byte b)
    {
      return (byte) (a ^ b);
    }
  public static int maxof(int a[])
    {
      int result=0,N=a.length;
      for (int i=0;i<N;i++)
       {
          if (i==0) result = a[0]; else
              if (a[i]>result) result = a[i];
       }
      return result;
    }
    public static int minof(int a[])
    {
      int result=0,N=a.length;
      for (int i=0;i<N;i++)
       {
          if (i==0) result = a[0]; else
              if (a[i]<result) result = a[i];
       }
      return result;
    }
    public static byte fgetc(FileInputStream f) throws IOException
    {
        int temp = f.read();
        if (temp == -1) return (byte)R.nextInt(); else return (byte)temp;
    }
    /*
     * @param args
     * @throws FileNotFoundException
     */
    public static void main(String[] args) throws FileNotFoundException, IOException {
        if (args.length != 3) {System.err.println("Usage: java -jar Wehrnam"
                + ".jar [file1] [file2] [output]"); return;}
        FileInputStream f1 = new FileInputStream(args[0]),
            f2 = new FileInputStream(args[1]);
        FileOutputStream ou = new FileOutputStream(args[2]);
        int temp[] = new int[2];
        temp[0] = f1.available();temp[1] = f2.available();
        int/* min = minof(temp),*/max = maxof(temp);
        byte a,b,c;
        R = new Random(System.nanoTime());
        for (int i=0;i<max;i++)
        {
            a=fgetc(f1);b=fgetc(f2);
            c = xor(a,b);
            ou.write(c);
        }
    }

}
/*Copyright (c) 2012 1pedosRUdeENBnhudrmdcrsW8SmGgxugE*/
/*HM0CqX8uRJ1L7Y0NBHGTTBlpDHnZOt5uiV/dU5w8WQtJjfTRER34jogD+TdghNUuZfLsLoueP5FlI70W0vogq1w=*/