fork download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <iterator>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. string n;
  10.  
  11. cin >> n;
  12.  
  13. const auto digits = "0123456789"s;
  14.  
  15. sort(begin(n), end(n));
  16. set_difference(cbegin(digits), cend(digits), cbegin(n), cend(n), ostream_iterator<char>(cout, " "));
  17. }
Success #stdin #stdout 0s 3476KB
stdin
87240
stdout
1 3 5 6 9