Implemented two versions of replicate a sequence