In general, one useful approach is to pass a length to the 'countedstring' function one smaller than the size of the buffer and then explicitly assign zero to the last character in the buffer.
The client writes the string to be counted into memcached, and the worker uses the ID supplied by the client to read the string, count the words, then writes the information back to memcached.
客户机把要被计数的字符串写入 memcached,工人使用客户机提供的 ID 读取字符串,统计单词数量,然后将信息写回 memcached。
3
Thus, two different sequence of "buy" days could produce the same string of decreasing prices and be counted as only a single solution.