it's not the best solution because it needs much memory in case of a big input files