fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <set>
  4. using namespace std;
  5.  
  6. int main() {
  7. string temp;
  8. getline(cin, temp);
  9. stringstream in(temp);
  10. int val;
  11. set<int> res;
  12. while (true) {
  13. in >> val;
  14. if (in)
  15. res.insert(val);
  16. else
  17. break;
  18. }
  19. cout << 4 - (int)res.size() << endl;
  20. return 0;
  21. }
Success #stdin #stdout 0s 15240KB
stdin
1 2 3 4 5
stdout
-1