From 3dd7c88a360418e00b42d83a4c6b9d1aa4bbef0a Mon Sep 17 00:00:00 2001 From: spector5 Date: Tue, 20 Oct 2015 21:05:45 -0400 Subject: [PATCH] finished --- src/Austin/Holes.java | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/Austin/Holes.java diff --git a/src/Austin/Holes.java b/src/Austin/Holes.java new file mode 100644 index 0000000..e2f3045 --- /dev/null +++ b/src/Austin/Holes.java @@ -0,0 +1,43 @@ +package Austin; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +// url: https://www.codechef.com/problems/HOLES +public class Holes +{ + + public static void main(String[] args) throws IOException + { + String line; + int tests; + int holes = 0; + int i = 0; + + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + line = br.readLine(); + tests = Integer.parseInt(line); + + while (i < tests) + { + line = br.readLine(); + for (int l = 0; l < line.length(); l++) + { + if (line.charAt(l) == 'A' || line.charAt(l) == 'D' || line.charAt(l) == 'O' || + line.charAt(l) == 'P' || line.charAt(l) == 'R' || line.charAt(l) == 'Q') + { + holes++; + } + if (line.charAt(l) == 'B') + { + holes += 2; + } + } + System.out.println(holes); + i++; + holes = 0; + } + + } + +}