UVA 445-Marvelous Mazes

#include <stdio.h>
#include <ctype.h>
int main()
{
	char ch;
	int i, count = 0;

	while ((ch = getchar()) != EOF) {
		if (isdigit(ch)) {
			count += ch - '0';
			continue;
		} else if (ch == '!' || ch == '\n')
			putchar('\n');
		else {
			if (ch == 'b')
				ch = ' ';
			for (i=0; i<count; ++i)
				putchar(ch);
			count = 0;
		}
	}
	return 0;
}

你可能感兴趣的:(UVA 445-Marvelous Mazes)