Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Test {
  5.     public static void main(String[] args) {
  6.         Scanner in = new Scanner(System.in);
  7.         int n = in.nextInt();
  8.         in.nextLine(); // skip new line
  9.         for (int i=0; i < n; i++) {
  10.             String s = in.nextLine();
  11.             for (char c : s.toCharArray()) {
  12.                 if (Character.isLetter(c)) {
  13.                     if (Character.isUpperCase(c)) {
  14.                         c += 1;
  15.                         if (c > 'Z') c = 'A';
  16.                     } else {
  17.                         c += 1;
  18.                         if (c > 'z') c = 'a';
  19.                     }
  20.                 }
  21.                 System.out.print(c);
  22.             }
  23.             System.out.println("");
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement