Java 代碼:
import java.util.*;
public class Different {
public boolean checkDifferent(String str) {
if (str == null || str.length() <= 0) {
return false;
}
if (str.length() > 256) {
return false;
}
for (int i =0; i < str.length(); i++) {
for (int j = i + 1; j < str.length() -1; j++) {
if ((str.charAt(i) ^ str.charAt(j)) == 0) {
return false;
}
}
}
return true;
}
}