Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 害人不浅，题目倒是挺简单，就是说的不明白。害得我忙了一下午。标点可以重复计数，但是ff等只计一次。给出参考

Posted by 20083331 at 2009-05-04 16:54:54 on Problem 3602
```#include<iostream>
#include<cstring>
using namespace std;

int map[256]={0};
int main()
{
int i;
//这里有点罗嗦了
for(i='a';i<='z';i++)
map[i]=0;
for(i='A';i<='Z';i++)
map[i]=0;

map[5]=0;//it is ff
map[6]=0;//it is fi
map[7]=0;//it is fl
map[8]=0;//it is ffi
map[9]=0;//it is ffl

char record[105];
int count=0;

while(cin>>record)
{
int len=strlen(record);
for(i=0;i<len;i++)
{
// it is ``
if(record[i]=='`' && record[i+1]=='`')
{
count++;
i++;
continue;
}
if(record[i]=='`')
{
count++;
continue;
}
// it is ''
if(record[i]=='\'' && record[i+1]=='\'')
{
count++;
i++;
continue;
}
if(record[i]=='\'')
{
count++;
continue;
}
// it is ffi
// it is ffl
if(record[i]=='f' && record[i+1]=='f' && (record[i+2]=='i' || record[i+2]=='l'))
{

if(record[i+2]=='i')
{
if(map[8]==0)
count++;
map[8]=1;
}
else
{
if(map[9]==0)
count++;
map[9]=1;
}
i=i+2;
continue;
}
// it is ff fi fl
if(record[i]=='f' && (record[i+1]=='f' || record[i+1]=='i' || record[i+1]=='l'))
{
if(record[i+1]=='f')
{
if(map[5]==0)
count++;
map[5]=1;
}
else if(record[i+1]=='i')
{
if(map[6]==0)
count++;
map[6]=1;
}
else
{
if(map[7]==0)
count++;
map[7]=1;
}
i++;
continue;
}

if(map[(int)record[i]]!=1)
{
//cout<<"we have count  this number"<<endl;
count++;
map[(int)record[i]]=1;
}
}
//		cout<<"this period is"<<count<<endl;
}
cout<<count<<endl;

return 0;
}```

Followed by: