fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <iterator>
  5. #include <cstring>
  6.  
  7. static int ARGC = 2;
  8. static const char* ARGV[] = {
  9. "op_xui",
  10. "aaaassssjknhfffqffoinnnnfnoasfzsdfsssnjhwpspmaaaaasdsdddbzz",
  11. NULL
  12. };
  13.  
  14. int main(int argc, const char* argv[])
  15. {
  16. argc = ARGC;
  17. argv = ARGV;
  18.  
  19. std::vector<char> array(&argv[1][0], &argv[1][0] + std::strlen(argv[1]));
  20.  
  21. std::sort(array.begin(), array.end(), std::less<char>());
  22.  
  23. std::cout << "Result: ";
  24. for (auto it = array.begin(); it != array.end(); it = std::lower_bound(it, array.end(), *it + 1))
  25. {
  26. if (it + 1 == array.end())
  27. {
  28. std::cout << *it;
  29. break;
  30. }
  31.  
  32. if (*it != *(it + 1))
  33. {
  34. std::cout << *it;
  35. }
  36. }
  37. std::cout << std::endl;
  38. return 0;
  39. }
  40.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Result: bikmqw