Fixed the problem (the statistics of words was not printed corectly) by slightly altering the usage of split() function (setting separator to default