Driver Code
let list = [ " " , " " ] ; for ( let i = 0 ; i < list . length ; i ++ ) { let cnt = countSub ( list [ i ] ) ; let withEmptyString = cnt + 1 ; document . write ( " " + list [ i ] + " " + withEmptyString + " " ) ; document . write ( " " + list [ i ] + " " + cnt + " " ) ; }