fork download
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. int t;
  8. cin>>t;
  9. while(t--){
  10. string s;
  11. int c=0;
  12. cin>>s;
  13. map<char,int>m;
  14. for(auto x:s){
  15. m[x]++;
  16. }
  17. for(auto x:s){
  18. if(m[x]>1){
  19. cout<<x<<"\n";
  20. c=1;
  21. break;
  22. }
  23. }
  24. if(c==0) cout<<"."<<"\n";
  25. }
  26. return 0;
  27. }
Success #stdin #stdout 0.01s 5548KB
stdin
4
datastructures
algorithms
bllaacckkboard
hackerrank
stdout
a
.
b
a