number of ways to arrange vowel
$ vowelArrange = factorial ( $ vowel ) ; $ vowelArrange /= factorial ( $ freq [ 0 ] ) ; $ vowelArrange /= factorial ( $ freq [ 4 ] ) ; $ vowelArrange /= factorial ( $ freq [ 8 ] ) ; $ vowelArrange /= factorial ( $ freq [ 14 ] ) ; $ vowelArrange /= factorial ( $ freq [ 20 ] ) ; $ consonantArrange = factorial ( $ consonant ) ; for ( $ i = 0 ; $ i < 26 ; $ i ++ ) { if ( $ i != 0 && $ i != 4 && $ i != 8 && $ i != 14 && $ i != 20 ) $ consonantArrange /= factorial ( $ freq [ $ i ] ) ; }