UVA 10222 Java

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

留言

這個網誌中的熱門文章

C# 井字遊戲