s = str(input("Enter the string: "))
count = 0
s1 = s.count('R')
s2 = s.count('G')
if s1>s2:
count = s2
else:
count = s1
print(count)
i want to know wht is the meaning of s1 and s2
s1 - the first string which contains number of "R" in the USER Input string.
s2 - the second string which contains the number of "G" in the USER input string.
For example, if the USER Input = Rare
Number "2" will be printed, because the string 'Rare' contains 2 "R"s, so count variable will be equal to 2.
Comments
Leave a comment