C - Dango Editorial by evima

Proposer's Implementation

If either o or - is absent in \(S\), the answer is \(-1\). Otherwise, the answer is the maximum number of consecutive o in \(S\), because if both o and - exist, any “block” of o is adjacent to -.

Sample Implementation (Python)

N, S = input(), input()
print(max(map(len, S.split('-'))) if 'o' in S and '-' in S else -1)

P.S. Here is dango:

posted:
last update: