A538: Cutting Banner

题目链接:http://codeforces.com/contest/538/problem/A

import java.util.Scanner;


public class A538 {

    void solve(){
        Scanner in=new Scanner(System.in);
        String str=in.next();
        String cf="CODEFORCES";
        int j=0;
        for(int i=0;i<cf.length()+1;i++){
            String first=cf.substring(0,i);
            String second=cf.substring(i, cf.length());
            System.out.println(first+","+second);
            System.out.println(str.startsWith(first) +","+str.endsWith(second));
            if(str.startsWith(first) && str.endsWith(second)){
                System.out.println("YES");
                return ;
            }
        }

        System.out.println("NO");


    }
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        new A538().solve();
    }

}

你可能感兴趣的:(A538: Cutting Banner)