You are given a string S of length N. Your task is to find the index(considering 1-based indexing) of the first unique character present in the string. If there are no unique characters return -1.
Note
A unique character in a string is the character that appears only once in the string. For example, ‘h’, ‘e’, and ‘o’ are the unique characters in the string “hello”.
Input format :
The first line of input contains a single integer T, denoting the number of test cases.
The first line of each test case contains a positive integer N, which represents the length of the string.
The next line of each test case contains a string S.
Output Format :
For each test case, return the index of the first unique character, and if there is no unique character return “-1”.
Note:
You do not need to print anything. It has already been taken care of. Just implement the given function.
Constraint :
1 <= T <= 100
1 <= N <= 10^4
Time Limit: 1 sec