I have a datset consisting of a large number character strings of length 12, drawn from a two state alphabet (z,x). Here are two examples.

```
  data <- c("zzxzzzxzzzzx","zzzxxzzzzzzx")

```

I wish to count the frequency of substrings which consist of sequences of consecutive "z's".

In this example the required frequencies are,

"zz", 1 (data[1] only)

"zzz", 2 (1 in each of data[1] and data[2])

"zzzz", 1 (in data[1] only)

"zzzzzz", 1 (in data[2} only