Java:
public static String removeNonLetters(String sentence) {
String removeNonLetters = "";
for (int i = 0; i < sentence.length(); i++) {
char character = sentence.charAt(i);
if ((character >= 'a' && character <= 'z' || character >= 'A' && character <= 'Z')) {
removeNonLetters = removeNonLetters + character;
}
}
return removeNonLetters.replaceAll("\s", "");
}