char first_unique_char_in_string(const string a)
{
//suppose string is composed of alphabets only ( a~z).
unsigned char count[26];
for(int i=0; i<26; i++) count[i] = 0; //initialize
for(int i=0; i
for(int i=0; i
return a[i];
return -1; //no unique char.
}
No comments:
Post a Comment