word method
Implementation
String word(String input) {
//func for returning the last word divided by space
String ans = "", wrd = input.split(" ").last;
int i = wrd.length - 1;
while (i >= 0 &&
(_isConsonant(wrd[i]) ||
_isVowel(wrd[i]) ||
_isPunct(wrd[i]) ||
_isDigit(wrd[i]))) {
ans = wrd[i] + ans;
i--;
}
return ans;
}