Bitmasking for each String s
s . split ( ' ' ) . forEach ( c => { val = val | ( 1 << ( c . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ) ) ; } ) ; var temp = val ; var first = s [ 0 ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ; var count = 0 ; while ( temp != 0 ) {