标签:
6 ABCCCDA LLLMNNO DEZZZBF AAABCCD KKKXPPQ AAA
4
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#
using namespace std;
char s[10];
int main()
{
int n;
while(~scanf("%d",&n))
{
map<int,int>ss;
int ans=0;
for(int i=0;i<n;i++)
{
scanf("%s",s);
int len=strlen(s);
int p=0;
int cnt=1;
for(int j=0;j<len;j++)
{
if(j==0) p=1;
if(s[j-1]==s[j]) p=p*10+cnt;
else p=p*10+(++cnt);
}
if(len<8)
{
for(int j=len;j<8;j++)
{
p=p*10+9;
}
}
ans+=ss[p];
ss[p]++;
}
printf("%d\n",ans);
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
hdu 2651 Spring festival couplets
标签:
原文地址:http://blog.csdn.net/wust_zjx/article/details/48117293