UVa 10082 WERTYU

为了熟悉JAVA而做
哈哈 又用了λ表达式

Code

import java.util.Scanner;

public class Main {
  final static String str = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";
  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    while (cin.hasNextLine()) {
      String s = cin.nextLine();
      s.chars().forEach(name -> {
        if (name != ' ') System.out.print(str.charAt(str.indexOf(name) - 1)); else System.out.print(' ');
      });
      System.out.print('\n');
    }
  }
}

你可能感兴趣的:(UVa 10082 WERTYU)