For this Question: Given a string s, find the first non-repeating character in the string and return its index. If it does not exist, return -1.First line of the input contains the string s.

<b>Constraints</b>
1<= s. length <= 100000Print the index of the first non- repeating character in a stringInput 
s = "newtonschool"

Output
1

Explanation 
"e" is the first non- repeating character in a string, I have written this Solution Code: /**
 *      Author : tourist1256
 *      Time   : 2022-01-10 12:51:16
 **/

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 2351
#endif

int firstUniqChar(string s) {
    map<char, int> charCount;
    int len = s.length();
    for (int i = 0; i < len; i++) {
        charCount[s[i]]++;
    }
    for (int i = 0; i < len; i++) {
        if (charCount[s[i]] == 1)
            return i;
    }
    return -1;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string str;
    cin>>str;
    cout<<firstUniqChar(str)<<"\n";
    return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?