View Code of Problem 3851

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int t=Integer.parseInt(scanner.nextLine());
        char[] right=new char[]{'q','w','e','r','t','y','u','i','o','p',
            'a','s','d','f','g','h','j','k','l',
            'z','x','c','v','b','n','m'};
        char[] wrong=new char[]{'w','e','r','t','y','u','i','o','p','[',
                's','d','f','g','h','j','k','l',';',
                'x','c','v','b','n','m',','};
        while(t-->0){
            String s=scanner.nextLine();
            char[] temp=s.toCharArray();
            for(int i=0;i<temp.length;i++){
                for(int j=0;j<wrong.length;j++){
                    if(temp[i]==wrong[j]){
                        temp[i]=right[j];
                    }
                }
            }
            StringBuilder sb=new StringBuilder();
            for(char c:temp){
                sb.append(c);
            }
            System.out.println(sb.toString());
        }
    }


}

Double click to view unformatted code.


Back to problem 3851