Created
December 5, 2018 19:35
-
-
Save aadouglass/673963f12ca26fe959089b44fabdd414 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input = list(open("C:\\Users\\andrewd\\Source\\Repos\\adoc\\d5.txt").read()) | |
print("Initial length of input:", len(input)) | |
set_deleted = 0 | |
del_count = 0 | |
while set_deleted < 1: | |
del_check = 0 | |
for x in range(len(input)-1): | |
if abs(ord(input[x]) - ord(input[x+1])) == 32: | |
input.remove(input[x]) | |
input.remove(input[x]) | |
del_check = 1 | |
del_count = del_count + 2 | |
break | |
if del_check == 0: | |
set_deleted = 1 | |
print("Number of characters deleted:", del_count) | |
print("Characters remaining:", input) | |
print("Number of characters remaining:", len(input)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment