https://leetcode.com/problems/first-unique-character-in-a-string
387. First Unique Character in a String
給一個字串s,找到第一個不重複的字元回傳其索引,不存在則回傳-1
Example 1:
Input: s = "leetcode"
Output: 0
Example 2:
Input: s = "loveleetcode"
Outpue: 2
Example 3:
Input: s = "aabb"
Output: -1
思路:
用for迴圈找出只出現一次的字元
Python3 code: