Last active
September 7, 2016 08:03
[Uva10222] Decode the Mad man
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Java | |
import java.util.Scanner; | |
class uva10222{ | |
public static void main(String args[]){ | |
Scanner sc=new Scanner(System.in); | |
String st="`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./"; //建立對照的表 | |
while(sc.hasNextLine()){ | |
String s=sc.nextLine().toLowerCase(); | |
//進行字元比較,並輸出隊的字元 | |
for(int i=0;i<s.length();i++){ | |
if(s.charAt(i)==' '){ | |
System.out.print(" "); | |
}else{ | |
for(int j=0;j<st.length();j++){ | |
if(s.charAt(i)==st.charAt(j)){ | |
if(j-2>0) System.out.print(st.charAt(j-2)); | |
else System.out.print(s.charAt(i)); | |
break; | |
} | |
} | |
} | |
} | |
System.out.println(""); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment