<p>Given a string <code>s</code>, find the <strong>first</strong> non-repeating character in it and return its index. If it <strong>does not</strong> exist, return <code>-1</code>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s = &quot;leetcode&quot;</span></p>

<p><strong>Output:</strong> <span class="example-io">0</span></p>

<p><strong>Explanation:</strong></p>

<p>The character <code>&#39;l&#39;</code> at index 0 is the first character that does not occur at any other index.</p>
</div>

<p><strong class="example">Example 2:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s = &quot;loveleetcode&quot;</span></p>

<p><strong>Output:</strong> <span class="example-io">2</span></p>
</div>

<p><strong class="example">Example 3:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s = &quot;aabb&quot;</span></p>

<p><strong>Output:</strong> <span class="example-io">-1</span></p>
</div>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>
	<li><code>s</code> consists of only lowercase English letters.</li>
</ul>

class Solution {
public:
    int firstUniqChar(string s) {
        return 0;
    }
};

auto _ = [](){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    std::ofstream out("user.out", std::ios::out | std::ios::binary);
    out.rdbuf()->pubsetbuf(nullptr, 256);
    std::noskipws(std::cin);
    
    string s;
    while (getline(cin, s)) {
        int seen[26] = {0};
        for (int i=1; i<s.size()-1; i++) {
            int j = s[i] - 'a';
            if (seen[j] == 0) seen[j] = i;
            else seen[j] = -1;
        }
        int ans = -1;
        for (auto& pos : seen) {
            if (pos != 0 && pos != -1) {
                if (ans == -1) ans = 100001;
                ans = min(ans, pos - 1);
            }
        }
        out << ans << "\n";
    }

    std::skipws(std::cin);
    out.flush();
    exit(0);
    return 0;
}();
7700