you give stre s length n contain kind character Q W e RA string say balanced character appear n 4 time n length stringreturn minimum length substring replace string length s balanced if s balanced return 0 example 1input s qweroutput 0explanation s balancedExample 2input s QQWEOutput 1explanation we need replace Q r rqwe qrwe balancedexample 3input s qqqwoutput 2explanation we replace QQ ER Constraintsn slength4 n 105n multiple 4s contain Q W e r