1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import java.util.Scanner; /** * UVA10222 */ public class UVA10222 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String chars = "`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./'"; String temp = null; while (sc.hasNextLine()) { temp = sc.nextLine().toLowerCase(); for (int i = 0; i < temp.length(); i++) { char c = temp.charAt(i); if (c == ' ') System.out.print(' '); else { int index = chars.indexOf(temp.charAt(i)); System.out.print(chars.charAt(index - 2)); } } System.out.println(); } sc.close(); } } |