TOPIC

Wrong answer (10%)

Clênio Eduardo da Silva asked 3 years ago

import java.io.IOException; import java.util.Scanner;

public class Main {

public static void main(String[] args) throws IOException {

            Scanner entr = new Scanner(System.in);

    String str;

    while (entr.hasNext()) {
        str = entr.nextLine();

        str = str.replace('B', 'F');
        str = str.replace('J', 'F');
        str = str.replace('P', 'F');
        str = str.replace('S', 'F');
        str = str.replace('V', 'F');
        str = str.replace('X', 'F');
        str = str.replace('Z', 'F');

        str = str.replace('b', 'f');
        str = str.replace('j', 'f');
        str = str.replace('p', 'f');
        str = str.replace('s', 'f');
        str = str.replace('v', 'f');
        str = str.replace('x', 'f');
        str = str.replace('z', 'f');

        str= str.replaceAll("[f]{1,100000000000}", "f");
        str= str.replaceAll("[F]{1,100000000000}", "F");

        str = str.replace("fF", "f");
        str = str.replace("Ff", "F");

        System.out.println(str);

    }

}

}

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.