(String).trim [1] public String trim()
文字列の前後の空白や改行を除去します。
String str = s.trim(); System.out.println("Your type: " + str);