Calculate length of a string input : <p>I made a program that calculates the length of a string that the user inputs. My program works fine for the most part but when I print "Hello World", it gives the length 5 (whereas it should be 11). How can I fix this?</p>

<pre><code>import java.util.Scanner;
public class StringLength {
        public static void main(String[] args){
            Scanner in = new Scanner(System.in);
            System.out.print("Enter the string: \n");
            String word = in.next();

            System.out.println("The length is: " +word.length());

    }

}
</code></pre>
