# 387. First Unique Character in a String

#### Easy

***

Given a string `s`, *find the first non-repeating character in it and return its index*. If it does not exist, return `-1`.

&#x20;

**Example 1:**

<pre><code>Input: s = "leetcode"
<strong>Output:
</strong> 0
</code></pre>

**Example 2:**

<pre><code>Input: s = "loveleetcode"
<strong>Output:
</strong> 2
</code></pre>

**Example 3:**

<pre><code>Input: s = "aabb"
<strong>Output:
</strong> -1
</code></pre>

&#x20;

**Constraints:**

* `1 <= s.length <= 105`
* `s` consists of only lowercase English letters.

```python
class Solution:
    def firstUniqChar(self, s: str) -> int:
        counter = Counter(s)
        for i in range(len(s)):
            if counter[s[i]] == 1:
                return i
        return -1
```
