<commit_before><commit_msg>count and say<commit_after>class Solution:
    # @return a string
    def countAndSay(self, n):
        result = "1"
        if n == 1:
            return result
        
        for i in xrange(2, n+1):
            new_result = ""
            curr_count = 1
            curr_num = result[0]
            for j in xrange(1, len(result)):
                if result[j-1] == result[j]:
                    curr_count += 1
                else:
                    new_result += str(curr_count)
                    new_result += str(curr_num)
                    curr_count = 1
                    curr_num = result[j]

            new_result += str(curr_count)
            new_result += str(curr_num)
            result = new_result
        return result

if __name__ == "__main__":
    solution = Solution()

    print solution.countAndSay(3)

{'fraction_non_alphanumeric': 0.0922722029988466, 'fraction_numerical': 0.012687427912341407, 'mean_word_length': 1.345945945945946, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3802041', 'n_tokens_mistral': 256, 'n_tokens_neox': 241, 'n_words': 61}