If exists then multiply the number of ways and decrement the frequency
if ( freq [ s . charCodeAt ( i ) - ' ' . charCodeAt ( 0 ) ] != 0 ) { ways = ways * freq [ s . charCodeAt ( i ) - ' ' . charCodeAt ( 0 ) ] ; freq [ s . charCodeAt ( i ) - ' ' . charCodeAt ( 0 ) ] -- ; }