http://codeforces.com/contest/549/problem/A
做的实在是太暴力了,嘿嘿
#include <iostream>
#include <cstring>
using namespace std;
char st[55][55];
int main()
{
int m,n;
while(cin>>m>>n)
{
memset(st,0,sizeof(st));
int sum=0;
for(int i=0; i<m; i++)
{
for(int j=0; j<n; j++)
{
cin>>st[i][j];
}
}
for(int i=0; i<m; i++)
{
for(int j=0; j<n; j++)
{
if(st[i][j]=='f'&&st[i][j+1]=='a'&&st[i+1][j]=='c'&&st[i+1][j+1]=='e')
sum++;
if(st[i][j]=='f'&&st[i][j+1]=='a'&&st[i+1][j]=='e'&&st[i+1][j+1]=='c')
sum++;
if(st[i][j]=='f'&&st[i][j+1]=='c'&&st[i+1][j]=='a'&&st[i+1][j+1]=='e')
sum++;
if(st[i][j]=='f'&&st[i][j+1]=='c'&&st[i+1][j]=='e'&&st[i+1][j+1]=='a')
sum++;
if(st[i][j]=='f'&&st[i][j+1]=='e'&&st[i+1][j]=='a'&&st[i+1][j+1]=='c')
sum++;
if(st[i][j]=='f'&&st[i][j+1]=='e'&&st[i+1][j]=='c'&&st[i+1][j+1]=='a')//f
sum++;
if(st[i][j]=='a'&&st[i][j+1]=='f'&&st[i+1][j]=='c'&&st[i+1][j+1]=='e')
sum++;
if(st[i][j]=='a'&&st[i][j+1]=='f'&&st[i+1][j]=='e'&&st[i+1][j+1]=='c')
sum++;
if(st[i][j]=='a'&&st[i][j+1]=='e'&&st[i+1][j]=='c'&&st[i+1][j+1]=='f')
sum++;
if(st[i][j]=='a'&&st[i][j+1]=='e'&&st[i+1][j]=='f'&&st[i+1][j+1]=='c')
sum++;
if(st[i][j]=='a'&&st[i][j+1]=='c'&&st[i+1][j]=='f'&&st[i+1][j+1]=='e')
sum++;
if(st[i][j]=='a'&&st[i][j+1]=='c'&&st[i+1][j]=='e'&&st[i+1][j+1]=='f')//a
sum++;
if(st[i][j]=='c'&&st[i][j+1]=='a'&&st[i+1][j]=='f'&&st[i+1][j+1]=='e')
sum++;
if(st[i][j]=='c'&&st[i][j+1]=='a'&&st[i+1][j]=='e'&&st[i+1][j+1]=='f')
sum++;
if(st[i][j]=='c'&&st[i][j+1]=='e'&&st[i+1][j]=='a'&&st[i+1][j+1]=='f')
sum++;
if(st[i][j]=='c'&&st[i][j+1]=='e'&&st[i+1][j]=='f'&&st[i+1][j+1]=='a')
sum++;
if(st[i][j]=='c'&&st[i][j+1]=='f'&&st[i+1][j]=='a'&&st[i+1][j+1]=='e')
sum++;
if(st[i][j]=='c'&&st[i][j+1]=='f'&&st[i+1][j]=='e'&&st[i+1][j+1]=='a')//c
sum++;
if(st[i][j]=='e'&&st[i][j+1]=='f'&&st[i+1][j]=='c'&&st[i+1][j+1]=='a')
sum++;
if(st[i][j]=='e'&&st[i][j+1]=='f'&&st[i+1][j]=='a'&&st[i+1][j+1]=='c')
sum++;
if(st[i][j]=='e'&&st[i][j+1]=='c'&&st[i+1][j]=='a'&&st[i+1][j+1]=='f')
sum++;
if(st[i][j]=='e'&&st[i][j+1]=='c'&&st[i+1][j]=='f'&&st[i+1][j+1]=='a')
sum++;
if(st[i][j]=='e'&&st[i][j+1]=='a'&&st[i+1][j]=='f'&&st[i+1][j+1]=='c')
sum++;
if(st[i][j]=='e'&&st[i][j+1]=='a'&&st[i+1][j]=='c'&&st[i+1][j+1]=='f')
sum++;
}
}
cout<<sum<<endl;
}
return 0;
}