A
arnuld
problem: write a function that counts the number of occurences of a
pair of letters in a string. e.g the pair "ab" appears twice in
"xabaacbaxabb".
i thought i could use "count()" from standard library but that works on
a container and "std::string" is not a container, its a class. even if
i put the "std::string" into a container then it will act as one elemnt
only e.g ["xabaaacbaxabb"] and hence count will not work (i tried it).
so can you please give some idea in solving this problem?
pair of letters in a string. e.g the pair "ab" appears twice in
"xabaacbaxabb".
i thought i could use "count()" from standard library but that works on
a container and "std::string" is not a container, its a class. even if
i put the "std::string" into a container then it will act as one elemnt
only e.g ["xabaaacbaxabb"] and hence count will not work (i tried it).
so can you please give some idea in solving this problem?