Created
October 8, 2017 17:32
-
-
Save mizushou/29847230b49bc8219be8919931e9f3a6 to your computer and use it in GitHub Desktop.
CODE FESTIVAL 2017 qual B 問題A
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
class Xxfestival { | |
public static void main(String[] args) { | |
Scanner scan = new Scanner(System.in); | |
String str = scan.next(); | |
int l =str.length(); | |
System.out.println(str.substring(0, l-8)); | |
} | |
} |
- substringのindexも配列同様、0~n
- 注意点はendのindexの直前の位置までの部分文字列となる
- abcdefで0-2を指定したらabcではなくabになる
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
問題文
りんごさんは、とある祭りに参加しようとしています。
その祭りの名称が FESTIVAL で終わる文字列 S として入力に与えられるので、りんごさんが何の祭りに参加しようしているのかを出力して下さい。
ただし、s の祭りの名称は s の末尾に FESTIVAL を 1 つだけ追加した文字列であるとします。 例えば CODEFESTIVAL は CODE の祭りです。
制約
9≤|S|≤50
S は大文字アルファベットのみからなる
S は FESTIVAL で終わる