fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <cstring>
  5.  
  6. static int ARGC = 2;
  7. static const char* ARGV[] = {
  8. "op_xui",
  9. "aaaaassssjknfffffoinnnnfnoaaaasfzzzzsdfsssnjhwwwpspmaaaaasdsdddb",
  10. NULL
  11. };
  12.  
  13. std::ostream& operator<<(std::ostream& o, const std::vector<char>& array)
  14. {
  15. for(auto it: array)
  16. {
  17. o<<it<<" ";
  18. }
  19. return o;
  20. }
  21.  
  22. int main(int argc, const char* argv[])
  23. {
  24. argc = ARGC;
  25. argv = ARGV;
  26.  
  27. std::vector<char> array(&argv[1][0], &argv[1][0] + std::strlen(argv[1]));
  28.  
  29. std::sort(array.begin(), array.end(), std::less<char>());
  30.  
  31. array.erase( std::unique(array.begin(), array.end()), array.end());
  32.  
  33. std::cout<<array;
  34.  
  35. return 0;
  36. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
a b d f h i j k m n o p s w z