#include <vector>
#include <string>
#include <iostream>


using namespace std;

// //NVI - klasa bazowa
// class Finder {
// public:
//  bool find(const std::vector<string>& names) const {
//      for(string n : names) { //wspolna petla
//          if(find_impl(n)) return true;
//      }
//      return false;
//  }
// private:
//  virtual bool find_impl(const string& name) const = 0;
// };

// class FinderName : public Finder {
// public:
//  FinderName(string name) : name_(name) {}

// private:
//  bool find_impl(const string& name) const override {
//      return name == name_;
//  }
//  string name_;
// };

// class FinderShorter : public Finder {
// public:
//  FinderShorter(int size) : size_(size) {}
// private:
//  bool find_impl(const string& name) const override {
//      return name.size() < size_;
//  }
//  int size_;
// };

// class FinderLength : public Finder {
// public:
//  FinderLength(int size) : size_(size) {}
// private:
//  bool find_impl(const string& name) const override {
//      return name.size() == size_;
//  }
//  int size_;
// };

class FinderName {
public:
    FinderName(string name) : name_(name) {}

    bool find(const std::vector<string>& names) const {
        for(string n : names) {
            if(n == name_)
                return true;
        }
        return false;
    }
private:
    string name_;
};


class FinderShorter {
public:
    FinderShorter(int size) : size_(size) {}

    bool find(const std::vector<string>& names) const {
        for(string n : names) {
            if(n.size() < size_)
                return true;
        }
        return false;
    }
private:
    int size_;
};

class FinderLength {
public:
    FinderLength(int size) : size_(size) {}

    bool find(const std::vector<string>& names) const {
        for(string n : names) {
            if(n.size() == size_)
                return true;
        }
        return false;
    }
private:
    int size_;
};

int main() {
    //  const char* NAMES = { "Abacki", "Babacki", "Cabacki", "Dabacki" };
    vector<string> v  = { "Abacki", "Babacki", "Cabacki", "Dabacki" };

    cout << FinderName("Babacki").find(v) << endl;
    cout << FinderName("Tabacki").find(v) << endl;
    cout << FinderShorter(7).find(v) << endl;
    cout << FinderShorter(6).find(v) << endl;
    cout << FinderLength(6).find(v) << endl;
    cout << FinderLength(5).find(v) << endl;
    return 0;
}
