Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <set>
  3. #include <fstream>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. ifstream input;
  11. input.open("input.txt");
  12. string s;
  13. set <string> ans;
  14. pair <string, int> num;
  15. num.second = 0;
  16. num.first = "";
  17. while (!input.eof()) {
  18. input >> s;
  19. if (isdigit(s[0]) && num.second == 0) {
  20. num.first = s;
  21. num.second = 1;
  22. }
  23. else if (s == num.first) {
  24. num.second++;
  25. }
  26. }
  27. for (set<string>::iterator it = ans.begin(); it != ans.end(); it++) {
  28. cout << *it << " ";
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement