<commit_before>package hackerrank;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/alternating-characters
 */
public class AlternatingCharacters {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
    }
}<commit_msg>Solve Alternating Characters<commit_after>package hackerrank;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/alternating-characters
 */
public class AlternatingCharacters {
    private static int alternatingChars(String str) {
        char[] chars = str.toCharArray();
        int count = 0;
        char prev = chars[0];
        for (int i = 1; i < chars.length; i++) {
            if (prev == chars[i]) {
                count++;
            }
            prev = chars[i];
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int testCases = in.nextInt();
        for (int t = 0; t < testCases; t++) {
            System.out.println(alternatingChars(in.next()));
        }
    }
}
{'fraction_non_alphanumeric': 0.1276794035414725, 'fraction_numerical': 0.003727865796831314, 'mean_word_length': 2.314814814814815, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5211693', 'n_tokens_mistral': 343, 'n_tokens_neox': 323, 'n_words': 76}