Official
B - モグラの穴 / Mole Holes Editorial by admin
swe-2-highThe program scans \(S\) from left to right. On #, it increments \(cur\), the length of the consecutive hole run ending at the current position; on ., it resets \(cur\) to \(0\). Every maximal run reaches its exact length at its final #, so updating \(best\) after each increment leaves the maximum run length. If there are no holes, \(best\) correctly remains \(0\). The scan takes \(O(N)\) time. Since the input string is stored and only a few counters are added, space complexity is \(O(N)\).