substr 与 substring
均是截取字符串长度;
均在头文件 <string> 中 包含;
substr(start,length);
start 表示起始的位置,length表示需要的长度
返回为 从 start开始,往后的length个元素,
若不写length 则 从start开始到结束
若length <= 0 则 s.substr(start, length) == NULL;
substring(start,end);
start 表示起始位置,end表示末尾位置
Two - gram:
题目:
Two-gram is an ordered pair (i.e. string of length two) of capital Latin letters. For example, "AZ", "AA", "ZA" — three distinct two-grams.
You are given a string ss consisting of nn capital Latin letters. Your task is to find any two-gram contained in the given string as a substring (i.e. two consecutive characters of