HW4Q3
user_7676782
python
3 years ago
479 B
10
Indexable
def checkMaxChar(str1):
myMax = 0
i = 0
while i < len(str1):
j = i + 1
charCounter = 1
while j < len(str1):
if str1[i] == str1[j]:
charCounter += 1
j += 1
if charCounter > myMax:
myMax = charCounter
char = str1[i]
i += 1
print(charCounter, myMax)
def main():
myStr = input("Enter a string: ")
checkMaxChar(myStr)
main()
Editor is loading...