<commit_before>---
layout: post
title:  "Remove consecutive repeating characters in a string"
date:   2017-09-17 12:58:27 -0400
categories: strings
---

```
inpstr = "<KEY>"
strlist = list(inpstr)

length   = len(strlist)
writeCtr = 0

for index in range(length-1):
    if index == 0 :
        strlist[writeCtr] = strlist[index]
        writeCtr = writeCtr + 1
    elif strlist[index] == strlist[index+1]:
        continue
    else:
        strlist[writeCtr] = strlist[index + 1]
        writeCtr = writeCtr + 1


outStr = strlist[0:writeCtr]


# printing the input and output
print("Input string  : " + inpstr)
print("Output string : " + "".join(outStr))
```
<commit_msg>Detect python code<commit_after>---
layout: post
title:  "Remove consecutive repeating characters in a string"
date:   2017-09-17 12:58:27 -0400
categories: strings
---

```python
inpstr = "<KEY>"
strlist = list(inpstr)

length   = len(strlist)
writeCtr = 0

for index in range(length-1):
    if index == 0 :
        strlist[writeCtr] = strlist[index]
        writeCtr = writeCtr + 1
    elif strlist[index] == strlist[index+1]:
        continue
    else:
        strlist[writeCtr] = strlist[index + 1]
        writeCtr = writeCtr + 1


outStr = strlist[0:writeCtr]


# printing the input and output
print("Input string  : " + inpstr)
print("Output string : " + "".join(outStr))
```

{'fraction_non_alphanumeric': 0.13431734317343175, 'fraction_numerical': 0.03837638376383764, 'mean_word_length': 3.146788990825688, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5829683', 'n_tokens_mistral': 515, 'n_tokens_neox': 471, 'n_words': 125}