For this Question: You are given a string S (containing only lowercase characters). You need to print the repeated character whose first appearance is leftmost.The first line of input contains T denoting the number of testcases. T testcases follow. 
Each testcase contains one line of input containing the string S.

Constraints:
1 <= T <= 100
1 <= |S| <= 1000For each testcase, in a new line, print the character. If not found then print "-1".Input:
2
geeksforgeeks
abcd

Output:
g
-1

Explanation:
Testcase1: We see that both e and g repeat as we move from left to right. But the leftmost is g so we print g.
Testcase2: No character repeats so we print -1.
 , I have written this Solution Code: #include<bits/stdc++.h>
using namespace std;

#define pu push_back
#define fi first
#define se second
#define mp make_pair
#define int long long
#define pii pair<int,int>
#define mm (s+e)/2
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(int i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define sz 200000
signed main()
{
	

		int t;
		cin>>t;
		while(t>0)
		{
			t--;
			string s;
			cin>>s;
            map<char,int> ss;
            int ch=-1;
			for(int i=0;i<s.size();i++)
			{
               ss[s[i]]++;
              
			}
			for(int i=0;i<s.size();i++)
			{
               
               if(ss[s[i]]>=2)
               { ch=0;
               	cout<<s[i]<<endl;
               	break;

               }
			}
			if(ch==-1) cout<<-1<<endl;




		}
	
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?