Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- bool isInlier(string str)
- {
- int len = str.length();
- int len2 = len /2 ;
- for (int index = 0; index < len2; index++){
- if (str.at(index) != str.at(len - index -1)) return false;
- }
- return true;
- }
- int main(int argc, char **argv)
- {
- std::ifstream infile(argv[1]);
- string line;
- int nInliers = 0;
- while (std::getline(infile, line))
- if(isInlier(line))nInliers++;
- cout << nInliers;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement