fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int t;
  7. cin>>t;
  8. while(t--)
  9. {
  10. string s;
  11. char c='#';
  12. cin>>s;
  13. for(int i=0;i<s.length();i++)
  14. {
  15. for(int j=i+1;j<s.length();j++)
  16. {
  17. if(s[i]==s[j])
  18. {
  19. c=s[i];
  20. break;
  21. }
  22. }
  23. }
  24. if(c=='#')
  25. {
  26. cout<<'.'<<"\n";
  27. }
  28. else
  29. {
  30. cout<<c<<"\n";
  31. }
  32. }
  33. return 0;
  34. }
Success #stdin #stdout 0.01s 5440KB
stdin
4
datastructures
algorithms
smartinterviews
hackerrank
stdout
u
.
e
r