fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t;
  6. cin>>t;
  7. while(t--)
  8. {
  9. string x;
  10. cin>>x;
  11. int s,c=0,w=0;
  12. s=x.length();
  13. for(int i=0;i<s;i++)
  14. {
  15. c=0;
  16. for(int j=0;j<s;j++)
  17. {
  18. if(x[j]==x[i])
  19. {
  20. c++;
  21. }
  22. }
  23. if(c>1)
  24. {
  25. w=x[i];
  26. break;
  27. }
  28. }
  29. if(c==0||w==0)
  30. {
  31. cout<<"."<<"\n";
  32. }
  33. else
  34. {
  35. cout<<(char)w<<"\n";
  36. }
  37. }
  38. return 0;
  39. }
Success #stdin #stdout 0.01s 5428KB
stdin
4
datastructures
algorithms
smartinterviews
hackerrank
stdout
a
.
s
a