Given a string S, write a program to find the first non-repeating character in it and return it's index.

Problem Note

  • If non-repeating character doesn't exist, return -1.
  • You may assume the string contain only lowercase letters.

Example 1

Input: S = "afteracademy"
Output: 1

Example 2

Input: S = "mindorks"
Output: 0

Example 3

Input: S = "abacdcd"
Output: -1