#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main(int argc, char* argv[])
{
	int currentCase = 0;
	while (!feof(stdin)) {
		int c = getc(stdin);
		if (c == EOF && ferror(stdin)) {
			perror("getc");
			exit(EXIT_FAILURE);
		}
		if (c == 'u')
			currentCase = 1;
		else if (c == 'l')
			currentCase = 0;

		int d = currentCase == 0 ? tolower(c) : toupper(c);
		if (putc(d, stdout) == EOF) {
			perror("putc");
			exit(EXIT_FAILURE);
		}
	}
}
