Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. bool isInlier(string str)
  6. {
  7. #include <iostream>
  8. #include <fstream>
  9. using namespace std;
  10.  
  11. bool isInlier(string str)
  12. {
  13. int len = str.length();
  14. int len2 = len /2 ;
  15. for (int index = 0; index < len2; index++){
  16. if (str.at(index) != str.at(len - index -1)) return false;
  17. }
  18.  
  19. return true;
  20. }
  21.  
  22. int main(int argc, char **argv)
  23. {
  24. std::ifstream infile(argv[1]);
  25.  
  26. string line;
  27. int nInliers = 0;
  28.  
  29. while (std::getline(infile, line))
  30. if(isInlier(line))nInliers++;
  31.  
  32. cout << nInliers;
  33.  
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement