import java.io.*;
import java.util.Scanner;
class crc_gen
{
    public String amay(String x, String y)
    {
    	System.out.println("in crc "+x+" "+y);
        ///BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int[] data;
        int[] div;
        int[] divisor;
        int[] rem;
        int[] crc;
        int data_bits, divisor_bits, tot_length;
        
        Scanner in = new Scanner(System.in);
        String data1 = x;
        String divisor1 = y;
        //String abcd = "10111010";
        //int data1[] = new int[abcd.length()];
//        for(int i=0;i<abcd.length();i++){
//        	data1[i] = abcd.charAt(i)-'0';
//        }
        //System.out.println(data1[0]+" "+data1[1]+" "+data1[2]+" "+data1[3]+" "+data1[4]+" "+data1[5]+" "+data1[6]+" "+data1[7]);
//        Scanner in = new Scanner(System.in);
//        String data1 = in.nextLine();
//        String divisor1 = in.nextLine()
        //System.out.println("Enter number of data bits : ");
        //data_bits=Integer.parseInt(br.readLine());
        data=new int[data1.length()];

         for(int i=0; i<data1.length(); i++)
            data[i] = data1.charAt(i)-'0';

        //System.out.println("Enter number of bits in divisor : ");
        //divisor_bits=Integer.parseInt(br.readLine());
        divisor=new int[divisor1.length()];
        
        ///System.out.println("Enter Divisor bits : ");
        for(int i=0; i<divisor1.length(); i++)
            divisor[i] = divisor1.charAt(i)-'0';


/*        System.out.print("Data bits are : ");
        for(int i=0; i< data_bits; i++)
            System.out.print(data[i]);        
        System.out.println();
        
        System.out.print("divisor bits are : ");
        for(int i=0; i< divisor_bits; i++)
            System.out.print(divisor[i]);        
        System.out.println();
        
*/        tot_length=data1.length()+divisor1.length()-1;
        
        div=new int[tot_length];
        rem=new int[tot_length];
        crc=new int[tot_length];
    /*------------------ CRC GENERATION-----------------------*/    
        for(int i=0;i<data.length;i++)
            div[i]=data[i];
        
        System.out.print("Dividend (after appending 0's) are : ");
        for(int i=0; i< div.length; i++)
            System.out.print(div[i]);        
        System.out.println();
        
        for(int j=0; j<div.length; j++){
              rem[j] = div[j];
        }
    
        rem=divide(div, divisor, rem);
        
        for(int i=0;i<div.length;i++)           //append dividend and ramainder
        {
            crc[i]=(div[i]^rem[i]);
        }
        
        System.out.println();
        System.out.println("CRC code : ");
        String return1 = "";
        for(int i=0;i<crc.length;i++)
            return1+=crc[i];
         System.out.println("yjjnnk "+return1);
         return return1;
           }
    
    static int[] divide(int div[],int divisor[], int rem[])
    {
        int cur=0;
        while(true)
        {
            for(int i=0;i<divisor.length;i++)
                rem[cur+i]=(rem[cur+i]^divisor[i]);
            
            while(rem[cur]==0 && cur!=rem.length-1)
                cur++;
    
            if((rem.length-cur)<divisor.length)
                break;
        }
        return rem;
    }
}
