implemented reduce and count function in Dstream