<jupyter_start><jupyter_text>2020년 3월 26일 목요일 HackerRank - String Manipulation : Alternating Characters 문제 :https://www.hackerrank.com/challenges/alternating-characters/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=strings 블로그 :https://somjang.tistory.com/entry/HackerRank-String-Manipulation-Alternating-Characters-Python  첫번째 시도<jupyter_code>#!/bin/python3

import math
import os
import random
import re
import sys

# Complete the alternatingCharacters function below.
def alternatingCharacters(s):
    count = 0
    for i in range(len(s)-1):
        if s[i] == s[i+1]:
            count = count + 1
    return count
alternatingCharacters('ABAAAB')
alternatingCharacters('ABAAABAAAAAAAAAAA')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10560625814863103, 'fraction_numerical': 0.020860495436766623, 'mean_word_length': 5.620689655172414, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '203623', 'license': 'MIT', 'n_tokens_mistral': 292, 'n_tokens_neox': 289, 'n_words': 48, 'path': 'DAY 001 ~ 100/DAY049_[HackerRank] String Manipulation Alternating Characters (Python).ipynb', 'repo_name': 'SOMJANG/CODINGTEST_PRACTICE', 'size': '767'}