Skip to content

Commit

Permalink
Create StringChallenge.py
Browse files Browse the repository at this point in the history
  • Loading branch information
saksham101 authored Jun 29, 2021
1 parent a33c1f9 commit 3d9a48a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions StringChallenge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def fun(strParam):
count = 0
outParam = ''
for i in range(1, len(strParam)):
if strParam[i] == strParam[i-1]:
count+=1
else:
outParam = outParam + str(count+1) + strParam[i-1]
count = 0
outParam = outParam + str(count+1) + strParam[i]
return outParam
print(fun(input()))

0 comments on commit 3d9a48a

Please sign in to comment.