fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. bool findAllDigits(istream & i){
  8. vector<char> digits(0); char c;
  9.  
  10. while(i >> c)//read one char
  11. if(isdigit(c) && find(digits.begin(), digits.end(), c)==digits.end())//check if it is a number and not in the vector
  12. digits.push_back(c);
  13.  
  14. return digits.size() == 10;//return true if all the digits are in the stream
  15. }
  16.  
  17.  
  18. int main() {
  19. cout << (findAllDigits(cin)?"FOUND":"NOT FOUND") << endl;
  20. return 0;
  21. }
Success #stdin #stdout 0s 3472KB
stdin
123, 8, 670, 4835134, 50243, 9
stdout
FOUND