Solución
solution.tsTypeScript
public class Solution {
public String rot13(String text) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
if(c >= 'A' && c <= 'Z') {
c = (char) ('A' + (c - 'A' + 13) % 26);
} else if (c >= 'a' && c <= 'z') {
c = (char) ('a' + (c - 'a' + 13) % 26);
}
sb.append(c);
}
return sb.toString();
}
}0respuestas