#include <iostream>
#include <string>
using namespace std;
int firstUniqChar(string s) {
int count[128] = {0};
for (char c : s) {
count[c]++;
}
for (int i = 0; i < s.size(); ++i) {
if (count[s[i]] == 1) {
return i;
}
}
return -1;
}
int main() {
string s;
cin >> s;
cout << firstUniqChar(s) << endl;
return 0;
}
全部回复 共 0 条
还没有人回复。往下写第一条。
发表回复
登录后即可回复本帖,与出题人和同学一起讨论。
登录