| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
100纪念题 留个印 贴个码,挺简洁,但时间长,不知WHY#include <stdio.h>
#include<string.h>
int main(int argc, char *argv[])
{
char str[1005],temp,temp1;
char str1[1005];
int n,i,j,sum;
int stop;
scanf("%d",&n);
getchar();
for(i=0;i<n;i++)
{
gets(str);
temp=str[0];
sum=1;
stop=1;
temp1=temp;
for(j=1;j<strlen(str);j++)
{
if(str[j]==temp)
{sum++;stop=sum;temp1=temp;}
else
{
sum=1;temp=str[j];
printf("%d%c",stop,temp1);
stop=1;
temp1=str[j];
}
}
printf("%d%c",stop,temp1);
printf("\n");
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator