fork download
  1. #include <bits/stdc++.h>
  2. #define endl '\n'
  3. using namespace std;
  4. bool vis[30];
  5. int main() {
  6. int t; string str;
  7. cin>>t;
  8. while(t--)
  9. {
  10. memset(vis,false,sizeof(vis));
  11. cin>>str;
  12. vector<char> places;
  13. for(char ch : str)
  14. if(!vis[ch-'a']) {
  15. vis[ch-'a'] = true;
  16. places.push_back(ch);
  17. }
  18. for(char c : places)
  19. cout << c;
  20. cout << '\n';
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 4348KB
stdin
1
maskd
stdout
maskd