package com.thinker.bishi.xiaomi;

/**
 * @author lzh
 */
public class Binary {
    public int countBitDiff(int m, int n) {
        int count = 0;
        int len = 32;
        while (len >= 0){
            if((1 & n) != (1 & m)) count ++;
            n >>= 1;m >>= 1;len --;
        }
        return count;
    }
    public char findFirstRepeat(String A, int n) {
        // write code here
        char result = ' ';
        boolean flag = false;
        for(int i=0;i<n-1;i++){
            for(int j=i+1;j<n;j++){
                if(A.charAt(i) == A.charAt(j)){
                    result = A.charAt(i);
                    flag = true;
                    break;
                }
            }
            if(flag) break;
        }
        return result;
    }


    public static void main(String[] args) {
        Binary binary = new Binary();
        System.out.println(binary.findFirstRepeat("kdbaaak",7));
    }
}
