import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
/**
* java控制台输入,几种方法
*
* @author ArLong
*
*/
public class Test {
public static void main(String[] args) throws IOException {
Test t = new Test();
// t.bufferRead();
// t.dataInput();
t.myScanner();
}
// 方法一
public void bufferRead() throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str = br.readLine();
System.out.println("输入字符串是:" + str + " 长度是:" + str.length());
}
// 方法二,已过时中文输入乱码
@SuppressWarnings("deprecation")
public void dataInput() throws IOException {
DataInputStream dis = new DataInputStream(System.in);
String str = dis.readLine();
System.out.println("输入字符串是:" + str + " 长度是:" + str.length());
}
// 方法三
public void myScanner() {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
System.out.println("输入字符串是:" + str.trim() + " 长度是:"
+ str.trim().length());
}
}