public class Solution {
    public int FirstNotRepeatingChar(String str) {
        class CharCount {
            public char ch;
            public int count;
            public int index;

            public CharCount() {
                count = 0;
            }
        }
        CharCount[] arr = new CharCount[64];
        int arr_len = 0;
        char tmp;
        boolean isFound;
        for (int i = 0; i < str.length(); i++) {
            tmp = str.charAt(i);
            isFound = false;
            for (int j = 0; j < arr_len; j++) {
                if (arr[j].ch == tmp) {
                    isFound = true;
                    arr[j].count++;
                }
            }
            if (!isFound) {
                CharCount ct = new CharCount();
                arr[arr_len] = ct;
                arr[arr_len].ch = tmp;
                arr[arr_len].count++;
                arr[arr_len].index = i;
                arr_len++;
            }
        }
        for (int i = 0; i < arr_len; i++) {
            if (arr[i].count == 1) {
                return arr[i].index;
            }
        }
        return -1;
    }
}