fork(3) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. class Main{
  4. static String c(String s){
  5. String o = "",
  6. a;
  7. char[] x = s.toCharArray(),
  8. y = new StringBuilder(s).reverse().toString().toCharArray();
  9. for(int i = 0; i < s.length(); i++){
  10. a = y[i]+"";
  11. o += x[i] > 64 & x[i] < 91
  12. ? a.toUpperCase()
  13. : a.toLowerCase();
  14. }
  15. return o;
  16. }
  17.  
  18. public static void main(String[] a){
  19. System.out.println(c("Hello, Midnightas"));
  20. System.out.println(c(".Q"));
  21. System.out.println(c("TEST"));
  22. System.out.println(c("test"));
  23. System.out.println(c("Test"));
  24. System.out.println(c(".,..,,!@"));
  25. System.out.println(c("ABCDefgHijklMNOPqrsTuVWxyz"));
  26. System.out.println(c("AbCdEfGHIJKlmnop123"));
  27. }
  28. }
Success #stdin #stdout 0.11s 320576KB
stdin
Standard input is empty
stdout
SathginDim ,olleh
q.
TSET
tset
Tset
@!,,..,.
ZYXWvutSrqpoNMLKjihGfEDcba
321pOnMLKJIhgfedcba