implemented deleteByWord method