Saturday, February 26, 2011

445 - Marvelous Mazes


#include<iostream>
#include<stdio.h>
#include<cstdlib>
using namespace std;
int main()
{
    char ch;
   // freopen("in.txt","r",stdin);
    int n=0,i;
    while(scanf("%c",&ch)==1)
    {
        if(ch>='0'&&ch<='9')
            n+=ch-48;
        else
        {
            if((ch>='A'&&ch<='Z')||ch=='*')
                for(i=1;i<=n;i++)
                    printf("%c",ch);
            else if(ch=='b')
                for(i=1;i<=n;i++)
                    printf(" ");
            else
                printf("\n");
            n=0;
        }
    }
    exit(0);
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.