All pastes #172261 Raw Edit

Someone

public text v1 · immutable
·published 2006-09-15 23:23 UTC
rendered paste body
#include <stdio.h>
#include <stdlib.h>

int main() {
	char opcode=getchar();
	char i=0;

	while(!feof(stdin)) {
		i=0;
		switch( opcode ) {
		case '+':
			while(opcode == '+' && !feof(stdin)) {
				opcode=getchar();
				i++;
			}
			printf("+%c", i);
			break;
		case '-':
			while(opcode == '-' && !feof(stdin)) {
				opcode=getchar();
				i++;
			}
			printf("-%c", i);
			break;
		case '>':
			while(opcode == '>' && !feof(stdin)) {
				opcode=getchar();
				i++;
			}
			printf(">%c", i);
			break;
		case '<':
			while(opcode == '<' && !feof(stdin)) {
				opcode=getchar();
				i++;
			}
			printf("<%c", i);
			break;
		default:
			printf("%c", opcode);
			opcode=getchar();
			break;
		}
	}
}