public class Solution {
public int FirstNotRepeatingChar(String
str) {
if(
str ==
null)
return -
1;
if(
str.length() ==
0)
return -
1;
int[] pos =
new int[
100];
for(
int i =
0; i <
100; ++i)
pos[i] = -
2;
for(
int i =
0; i <
str.length(); ++i) {
if(pos[
str.charAt(i) -
65] == -
2) pos[
str.charAt(i) -
65] = i;
else {
pos[
str.charAt(i) -
65] = -
1;
}
}
for(
int i =
0; i <
str.length(); ++i) {
if(pos[
str.charAt(i) -
65] != -
2 && pos[
str.charAt(i) -
65] != -
1)
return pos[
str.charAt(i) -
65];
}
return 0;
}
public static void main(String[] args) {
System.out.println((
int)
'z');
}
}