/**
* An application which writes, to System.out, the Rot13 encoding
* of each of its command line arguments, separated by a single
* space.
*/
public class Rot13 {
/**
* Runs the application.
*/
public static void main(String[] args) {
for (String s: args) {
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
char lower = Character.toLowerCase(c);
// Convert a..m <==> n..z
if ('a' <= lower && lower <= 'm') {
c += 13;
} else if ('n' <= lower && lower <= 'z') {
c -= 13;
}
System.out.print(c);
}
// Separate the encoding of each argument with a space
System.out.print(' ');
}
// Finish the entire encoding with an end-of-line
System.out.println();
}
}