HDU 1020(水题)

来源:互联网 发布:cache数据库 东华 编辑:程序博客网 时间:2024/05/21 11:10

题意:如题。

 

#include<string.h>#include<stdio.h>int main (){  int t ;  char str[10005]; while( scanf("%d" , &t ) != EOF ) {  while( t-- )  {      scanf("%s" , str);      int len = strlen ( str );      for( int i = 0 ; i < len ; i++  )      {          int hh = 1 ;          for( int j = i+1 ; j < len ; j++ )             if( str[i] == str[j] )hh++;             else break;          if( hh > 1 )            printf("%d%c", hh , str[i] );          else            printf("%c" , str[i]);                    i +=(hh-1);      }      puts("");  } }  return 0;}


 

0 0