public static void main(String[] args) throws FileNotFoundException {
        final Scanner in = new Scanner(new FileInputStream("in"));
//        final Scanner in = new Scanner(System.in);
        System.setOut(new PrintStream("out.pancake"));
        final int t = in.nextInt();
        in.nextLine();
        for (int caseNum = 1; caseNum <= t; caseNum++) {
            final String str = in.nextLine();
            char cur = str.charAt(0);
            int flip = cur == '-' ? 1 : 0;
            for (int i = 0; i < str.length(); i++) {
                if (str.charAt(i) != cur) {
                    if (cur == '+') {
                        flip += 2;
                    }
                    cur = str.charAt(i);
                }
            }
            System.out.println(String.format("Case #%d: %s", caseNum, flip));
        }
    }