public static String getWord(String str) {
int firstCharPos = -1;
int lastCharPos = -1;
for (int i = 0; i < str.toCharArray().length; i++) {
char ch = str.charAt(i);
<BUG>if (Character.isLetter(ch)) {
if (firstCharPos < 0) {</BUG>
firstCharPos = i;
}
lastCharPos = i;

public static String getWord(String str) {
int firstCharPos = -1;
int lastCharPos = -1;
for (int i = 0; i < str.toCharArray().length; i++) {
char ch = str.charAt(i);
if (Character.isLetter(ch) || Character.isDigit(ch)) {
if (firstCharPos < 0) {
firstCharPos = i;
}
lastCharPos = i;
