#include "../../include/aoc.hpp" #include using namespace std; vector towels; bool rec(string_view s) { if (s.empty()) { return true; } for (auto &t : towels) { if (s.starts_with(t) && rec(s.substr(t.size()))) { return true; } } return false; } int main() { ios::sync_with_stdio(0); cin.tie(0); string line; getline(cin, line); istringstream ll(line); string s; while (getline(ll, s, ',')) { towels.push_back(s); ll.ignore(); } cin.ignore(); ull count = 0; while (getline(cin, line)) { if (rec(line)) { count++; } } cout << count << '\n'; }