you give 0indexed binary string s represent type buildings street wheresi 0 denote ith building office andsi 1 denote ith building restaurantAs city official like select 3 building random inspection however ensure variety consecutive building select building typefor example give s 001101 select 1st 3rd 5th building form 011 allow having consecutive building typereturn number valid way select 3 building Example 1input s 001101output 6explanation the follow set index select valid 024 001101 form 010 034 001101 form 010 124 001101 form 010 134 001101 form 010 245 001101 form 101 345 001101 form 101no selection valid thus 6 total waysExample 2input s 11100output 0explanation it show valid selection constraints3 slength 105si 0 1