summaryrefslogtreecommitdiff
path: root/comp/work/45/paircount.py
blob: c9af5f002ad0e78afdd2ddf50b75b9fabb809c96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
word = input("input your word: ") + ' '

pairs = ""

for i in range(1, len(word)):
    if word[i] == word[i-1]:
        pairs += word[i]
        print(word[i-1].upper(), end='')
    else:
        print(word[i-1], end='')
print("")

done = ""
total = 0

for i in pairs:
    if (i not in done):
        done += i
        total += pairs.count(i)
        print(f"you have {pairs.count(i)} pairs of {i}")

print("you have", total, "pairs total")