Test case Error


#1

abcbca for this test case, my code that gives 0 output but expected output is 1 and the compiler says that my code is correct passing all submission cases as well. Here is my code-
int Solution::anytwo(string A) {
string B = A;
int i = 0;
int j = 0;
int count = 0;
int x = 0;
for(int j = 0;j<B.size();j++) {
int i = x;
while(i < A.size()) {
if(A[i] == B[j] && i != j) {
x = ++i;
count++;
break;
} else {
i++;
}
}
}
return count>=2;
}