早教吧 育儿知识 作业答案 考试题库 百科 知识分享

杭电ACM水题EncodingProblemDescriptionGivenastringcontainingonly'A'-'Z',wecouldencodeitusingthefollowingmethod:1.Eachsub-stringcontainingksamecharactersshouldbeencodedto"kX"where"X"istheonlycharacterinthissub-

题目详情
杭电ACM 水题 Encoding
Problem Description
Given a string containing only 'A' - 'Z', we could encode it using the following method:
1. Each sub-string containing k same characters should be encoded to "kX" where "X" is the only character in this sub-string.
2. If the length of the sub-string is 1, '1' should be ignored.
Input
The first line contains an integer N (1
▼优质解答
答案和解析
#include
#include
main()
{
int a;
int n,i,l;
char b[10001];
scanf("%d",&n);
while(n--)
{
memset(b,'\0',10001);
scanf("%s",b);
l=strlen(b);
i=0;
a=1;
while(i