import java.util.List;
import java.util.Arrays;
public class Program {
public static int lengthOfLastWord(String str) {
List<String> words = Arrays.asList(str.split(" "));
return words.get(words.size() - 1).length();
}
public static void main(String[] args) {
String input = "java c go javascript rust";
System.out.println("The length of the last word is: " + lengthOfLastWord(input));
}
}
/*
run:
The length of the last word is: 4
*/