简单题

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
string st;
string g[100] =
{ "ffi", "ffl", "ff", "fl", "fi", "''", "``", "'", "`", ":", ";", ",", ".",
"?", "!" };
bool vis[300];
int main()
{
//freopen("t.txt", "r", stdin);
string a;
st = "a";
for (int i = 15; i < 41; i++)
{
g[i] = st;
st[0]++;
}
st = "A";
for (int i = 41; i < 67; i++)
{
g[i] = st;
st[0]++;
}
st = "";
while (getline(cin, a))
st += a;
int i = 0;
int len = st.length();
memset(vis, 0, sizeof(vis));
int ans = 0;
while (i < len)
{
bool found = false;
for (int j = 0; j < 67; j++)
{
int l = g[j].length();
if (l + i <= len && st.substr(i, l) == g[j])
{
i += l;
found = true;
if (!vis[j])
{
vis[j] = true;
ans++;
}
break;
}
}
if (!found)
i++;
}
printf("%d\n", ans);
return 0;
}