日期:2014-05-17  浏览次数:20532 次

http://acm.hdu.edu.cn/showproblem.php?pid=1020大水题一个不解释
#include<string>
#include<cstdio>
#include<map>
#include<algorithm>
#include<string.h>
#include<cmath>
#include<iostream>
using namespace std;
int main()
{
 int t;
 scanf("%d",&t);
 string str;
  while(t--)
  {
	  map<char,int>M;
       cin>>str;

	for(int i=0;i<str.size();i++)
	{
	  char p=str[i];
	  int kk=0;
	  while( ++i < str.size() && p==str[i] )kk++;
	  i--;
	  if(kk==0)
	  {
	   printf("%c",p);
	  }else
	  {
	  printf("%d%c",kk+1,p);
	  }
	}
	printf("\n");
  }
	return 0;
}