#include #include int firstUniqChar(char *s) { int hash[26]; memset(hash, 0, sizeof(int) * 26); for (int idx = 0; s[idx]; idx++) hash[s[idx] - 'a']++; for (int idx = 0; s[idx]; idx++) if (hash[s[idx] - 'a'] == 1) return idx; return -1; }