fork(3) download
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. int main() {
  5. char *pass = "Qqqqqqqwwwww11111"; // or by user input
  6.  
  7. // using std::string is easier and safer (works similarly with std::vector)
  8. std::string data(pass);
  9.  
  10. // Remove duplicates with std::sort and std::unique
  11. std::sort(data.begin(), data.end());
  12. auto end = std::unique(data.begin(), data.end());
  13.  
  14. // Remove duplicates – if needed.
  15. data.erase(end, data.end());
  16.  
  17. // Print the unique chars
  18. std::cout << data << std::endl;
  19. return 0;
  20. }
Success #stdin #stdout 0s 3432KB
stdin
Standard input is empty
stdout
1Qqw