For this Question: Given a string s consisting of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.

If the last word does not exist, return 0.

Note: A word is defined as a character sequence consists of non-space characters only.Input contains a single line string.

Constraints:

1 <= |String length| <= 100000Output the length of the last word.Sampe input 1
Hello World

Sample output 1
5


Explanation
Given s = "Hello World",

return 5 as length("World") = 5.

Please make sure you try to solve this problem without using library functions. Make sure you only traverse the string once., I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException {

		  BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
		  String line = br.readLine();
		  String x= line.trim();
		   int len=0;
		   String part[] = line.split(" ");

		  System.out.println(part[part.length - 1].length());

	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?