Skip to content

Instantly share code, notes, and snippets.

@Abreto
Created February 3, 2013 06:47
Show Gist options
  • Save Abreto/4700774 to your computer and use it in GitHub Desktop.
Save Abreto/4700774 to your computer and use it in GitHub Desktop.
UVa - 445 - Marvelous Mazes.
/* UVa OJ. 445 - Marvelous Mazes. */
#include <stdio.h>
#include <string.h>
int main()
{
int i = 0, j = 0;
char line[150], out;
int sum;
while(gets(line))
{
if(line[0] == 32)
{
printf("\n");
continue;
}
else for(i = 0;i < strlen(line);i++)
{
if( line[i] >= '0' && line[i] <= '9' )
{
sum += (int)(line[i]-'0');
} else if( line[i] == '!' ) {
printf("\n");
} else {
if( line[i] == 'b' )
out = ' ';
else
out = line[i];
for(j = 0;j < sum;j++)
printf("%c", out);
sum = 0;
}
}
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment