段階2
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class StringCheck {
|
public class StringCheck {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@@ -8,6 +9,15 @@ public class StringCheck {
|
|||||||
sentences[1]= "何も入力されていません";
|
sentences[1]= "何も入力されていません";
|
||||||
sentences[2]= "投稿文が長すぎます";
|
sentences[2]= "投稿文が長すぎます";
|
||||||
sentences[3]= "↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓";
|
sentences[3]= "↓↓↓↓↓↓ 投稿されました ↓↓↓↓↓↓";
|
||||||
}
|
|
||||||
|
|
||||||
|
Scanner scan = new Scanner(System.in);
|
||||||
|
String str = scan.nextLine();
|
||||||
|
// 標準入力から1行分の文字列を読み込む
|
||||||
|
|
||||||
|
String trimmedstr = str.trim();
|
||||||
|
// 前後の空白を削除
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println(trimmedstr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user