vec <- c("time of the day", "word of the day", "time the day")
gsub("\\bof the\\b(*SKIP)(?!)|\\bthe\\b", "of the", vec, perl=TRUE)
## => [1] "time of the day" "word of the day" "time of the day"
dmVjIDwtIGMoInRpbWUgb2YgdGhlIGRheSIsICJ3b3JkIG9mIHRoZSBkYXkiLCAidGltZSB0aGUgZGF5IikKZ3N1YigiXFxib2YgdGhlXFxiKCpTS0lQKSg/ISl8XFxidGhlXFxiIiwgIm9mIHRoZSIsIHZlYywgcGVybD1UUlVFKQojIyA9PiBbMV0gInRpbWUgb2YgdGhlIGRheSIgIndvcmQgb2YgdGhlIGRheSIgInRpbWUgb2YgdGhlIGRheSIK