User blog comment:Hyp cos/R function v2.0.1/@comment-5529393-20150410140740/@comment-11227630-20150410145020

You must start to scan a {A1A2...Ak+m} before, and all the Ai are separators, then you can meet case D. The step 1 means you set Ss to that {A1A2...Ak+m}.