fork download
  1. #include <iostream>
  2. #include <fstream>
  3. #include <iterator>
  4. #include <cctype>
  5.  
  6.  
  7. int main() {
  8. std::size_t const cyphersCount = '9' - '0' + 1;
  9. bool cyphers[cyphersCount] = {false};
  10.  
  11. std::size_t const lettersCount = 'z' - 'a' + 1;
  12. bool letters[lettersCount] = {false};
  13.  
  14. // std::ifstream istream("filename");
  15. std::istream & istream = std::cin;
  16. for (std::istream_iterator<char> it(istream), end; it != end; ++it) {
  17. if (std::isdigit(*it)) {
  18. cyphers[*it - '0'] = true;
  19. } else if (std::isalpha(*it)) {
  20. letters[std::tolower(*it) - 'a'] = true;
  21. }
  22. }
  23.  
  24. for (std::size_t i = 0; i != cyphersCount; ++i) {
  25. if (!cyphers[i]) {
  26. std::cout << static_cast<char>(i + '0');
  27. }
  28. }
  29. for (std::size_t i = 0; i != lettersCount; ++i) {
  30. if (!letters[i]) {
  31. std::cout << static_cast<char>(i + 'a');
  32. }
  33. }
  34. std::cout << std::endl;
  35. }
Success #stdin #stdout 0s 3344KB
stdin
ddfjgn 239u jdfgjjergnerie449
stdout
015678abchklmopqstvwxyz