UVA 455

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char s[140];
int len,i,j,a=0,b;
int main()
{
     while (fgets(s,140,stdin))
    {
 
          len =strlen(s);
          for (i=0;i<len;i++)
          { 
              if (s[i]>48 && s[i]<58)
              {
                 b = s[i]-'0';
                 a+=b;
              }
              else 
              {
                  if (s[i]=='b') {for (j=1;j<=a;j++) printf(" ");}
                  else
                  {
                      if (s[i]=='!') {printf("\n");}
                      else
                          for (j=1;j<=a;j++)
                              printf("%c",s[i]);
                  }
                  a = 0;
              }
              if (i==len-1) printf("\n");
          }
    }
    return 0;
}

 

posted @ 2012-04-29 09:27  open your eyes  阅读(866)  评论(0编辑  收藏  举报