#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
template<typename State>
struct AhoCorasick {
	using string_t = typename State::string_t;
	using char_t = typename State::char_t;
	vector<State> pma;
	vector<int> lens;

	AhoCorasick(const vector<string_t> &str) : pma(0), lens(0) {
		pma.push_back(State());
		for (const string_t &s : str) {
			int t = 0;
			for (char_t c : s) {
				if (!pma[t].is_set(c)) {
					pma[t][c] = pma.size();
					pma.push_back(State());
				}
				t = pma[t][c];
			}
			pma[t].accept.push_back(lens.size());
			lens.push_back(s.size());
		}
		queue<int> que;
		for (char_t c = 'a'; c <= 'z'; c++) {
			if (pma[0].is_set(c)) {
				pma[pma[0][c]].fail = 0;
				que.push(pma[0][c]);
			}
			else {
				pma[0][c] = 0;
			}
		}
		while (!que.empty()) {
			int t = que.front();
			que.pop();
			for (char_t c = 'a'; c <= 'z'; c++) {
				if (pma[t].is_set(c)) {
					que.push(pma[t][c]);
					int r = pma[t].fail;
					while (!pma[r].is_set(c)) r = pma[r].fail;
					pma[pma[t][c]].fail = pma[r][c];
					for (int i : pma[pma[r][c]].accept) {
						pma[pma[t][c]].accept.push_back(i);
					}
				}
			}
		}
	}
	int next(int index, char_t c) {
		return pma[index].is_set(c) ?
			pma[index][c] :
			pma[index][c] = next(pma[index].fail, c);
	}
	vector<int> query(string_t &t) {
		int index = 0;
		vector<int> ret(lens.size(), -1);
		for (int i = 0; i < int(t.size()); ++i) {
			char_t c = t[i];
			index = next(index, c);
			for (int j : pma[index].accept) {
				if (ret[j] != -1) continue;
				ret[j] = i - lens[j] + 1;
			}
		}
		return ret;
	}
};

struct State {
	using string_t = string;
	using char_t = char;
	vector<int> edge;
	int fail;
	vector<int> accept;
	State() : fail(0), accept(0) { edge.resize(26); fill(begin(edge), end(edge), -1); }
	int& operator[] (char_t c) { return edge[c - 'a']; }
	const int& operator[] (char_t c) const { return edge[c - 'a']; }
	bool is_set(char_t c) { return edge[c - 'a'] >= 0; }
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int n;
	cin >> n;
	vector<string> p(n);
	REP(i, n)cin >> p[i];
	AhoCorasick<State> ac(p);
	int index = 0;
	int ans = 0;
	REP(i, s.size()) {
		index=ac.next(index, s[i]);
		if (ac.pma[index].accept.size() != 0) {
			ans++;
			index = 0;
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 17364