hello again! there is an error in my previous post: your.string <- "aaacdf" nc1 <- nchar(your.string)-1 x <- unlist(strsplit(your.string, NULL)) ######## CORRECT x2 <- c() for (i in 1:nc1) x2 <- c(x2, paste(x2[i], x2[i+1], sep="")) cat("ocurrences of <aa> in <your.string>:", length(grep("aa", x2)), sep="", fill=TRUE) Hope it helps! Fran