sdut oj 2761 编码#include <stdio.h>
#include <string.h>


int main()
{
    char s[10010];
    int i, x, a, p;
    while(gets(s))
    {
        a = 1;
        p = 0;
        x = strlen(s);
        for(i = 0; i <= x - 1; i++)
        {
            if(s[i] == s[i + 1])
            {
                a++;
                p = 1;
            }
            else if(p != 1)
                printf("%c", s[i]);
            else
            {
                printf("%d%c", a, s[i]);
                p = 0;
                a = 1;
            }
        }
        printf("\n");
    }
    return 0;
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2021-05-24
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
  • 2021-10-12
猜你喜欢
  • 2021-07-25
  • 2021-08-07
  • 2021-10-24
  • 2021-12-30
  • 2021-04-27
  • 2022-01-13
  • 2021-06-25
相关资源
相似解决方案