【UVa】[10082]WERTYU

Problem Description

Loading...

Problem Analysis

One detail: the escape character \ is involved
so when building the string s you have to write \\ to represent a single \
everything else is just printing the character before it

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include<stdio.h>
int main() {
	char s[]="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";
	int i,c;
	while((c=getchar())!=EOF) {
		for(i=1; s[i]&&s[i]!=c; i++);
		if(s[i])
			putchar(s[i-1]);
		else
			putchar(c);
	}
	return 0;
}

Problem links:
【UVa】[10082]WERTYU 【POJ】[2538]WERTYU

Loading...