public int getCommon(String a, String b, int limit) {
        if(a.length() < limit) limit = a.length();
        if(b.length() < limit) limit = b.length();
        
        for(int i = 0; i < limit; i++) {
            if(a.charAt(i) != b.charAt(i)) return i;
        }
        return limit;
    }