Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <cmath>
- using namespace std;
- bool IsPalindrom(string s) {
- for (size_t i = 0; i < s.size() / 2; ++i) {
- if (s[i] != s[s.size() - i - 1]) {
- return false;
- }
- }
- return true;
- }
- vector<string> PalindromFilter(vector<string> words, int minLength) {
- vector<string> Output;
- for (auto i : words) {
- if (IsPalindrom(i) && i.size >= minLength) {
- Output.push_back(i);
- }
- }
- return Output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement