Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

Submission issues

$
0
0

Hey Chefs, I have some trouble submitting my code. I am getting this error "Main.java:6: class HolesInText is public, should be declared in a file named HolesInText.java public class HolesInText { ^ 1 error"

out of this code:

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter;

public class HolesInText {

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

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    PrintWriter pw = new PrintWriter(System.out);

    int number_testcases = Integer.parseInt(in.readLine());

    for (int i = 0; i < number_testcases; i++) {
        String string = in.readLine();
        char[] char_array = string.toCharArray();
        int counter = 0;

        for (char character : char_array) {
            if (character == 'B') {
                counter += 2;
            } else if (character == 'A' || character == 'D'
                    || character == 'O' || character == 'P'
                    || character == 'Q' || character == 'R') {
                counter++;
            }
        }
        pw.println(counter);
    }
}

}

What should I do to please the system?

Thanks!


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>