やるだけ。問題を理解するまで時間がかかった。
class ReadingBooks {
public:
int countBooks(vector <string> R)
{
int ret = 0;
for (int i = 0; i + 3 <= (int)R.size(); ++i) {
bool a = count(R.begin() + i, R.begin() + i + 3, "introduction");
bool b = count(R.begin() + i, R.begin() + i + 3, "story");
bool c = count(R.begin() + i, R.begin() + i + 3, "edification");
if (a && b && c) {
++ret;
i += 2;
}
}
return ret;
}
};