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

using namespace std;

struct Node {
	char v;
	bool end;
	vector<Node*> next;
};

Node *get_node(char v) {
	Node *node = new Node();
	node->v = v; node->end = false;
	node->next.resize(26);
	return node;
}

void add(Node *h, string s, int idx) {
	if (s.size() == idx) {
		h->end = true;
		return;
	}

	if (h->next[s[idx] - 'a'] == NULL) {
		h->next[s[idx] - 'a'] = get_node(s[idx]);
	}

	add(h->next[s[idx] - 'a'], s, idx + 1);
}

Node* pre(vector<string> d) {
	Node *h = get_node('$');
	for (string s : d) {
		add(h, s, 0);
	}
	return h;
}

bool find(Node *h, string s, int idx) {
	if (idx == s.size()) return h->end;
	if (h->next[s[idx] - 'a'] != NULL) return find(h->next[s[idx] - 'a'], s, idx + 1);
	return false;
}

int count(Node *base, Node *h, string s, int idx) {
	if (idx == s.size()) return h->end;

	int res = 0;
	if (h->end) {
		res += count(base, base, s, idx);
	}

	if (h->next[s[idx] - 'a'] != NULL) { 
		res += count(base, h->next[s[idx] - 'a'], s, idx + 1);
	}

	return res;
}

int main() {
	vector<string> d(9);
	d[0] = "st";
	d[1] = "ck";
	d[2] = "cag";
	d[3] = "low";
	d[4] = "tc";
	d[5] = "rf";
	d[6] = "ove";
	d[7] = "a";
	d[8] = "sta";

	Node *h = pre(d);
	cout << "Indexing done" << endl;
	string s;
	cin >> s;
	cout << count(h, h, s, 0) << endl;
	return 0;
}