Red or Green



Problem "R" means "Red" and "G" means "Green". To find which minimum color to replace make all the colors are same and print number of colors replaced.



Example-1:


Input    : s = "RGRGR"
Output   : 2
Explain  : To replace all the "G" to "R".The string is "RRRRR". That is a minimum
           replace to make all colors are same.  


Example-2:


Input    : s = "GGGRGRR"
Output   : 3
Explain  : To replace all the "R" to "G".The string is "GGGGGGG". That is a minimum
           replace to make all colors are same.    


Example-3:


Input    : s = "RGRG"
Output   : 2
Explain  : we can either to replace "R" to "G" or "G" to "R".  







Solution





s = "RGRGR"

a = s.count("R")

b = s.count("G")

if(a>b):

    print(b)

elif(a==b):

    print(a)

else:

    print(a)



Output



2