Maintain the suffix count
State: position counter \(t\), representative \(v\), suffix counter \(r\).
On arrival of \(s_t\):
- With probability \(1/t\), set \(v\gets s_t\) and \(r\gets1\).
- Otherwise, if \(s_t=v\), set \(r\gets r+1\).
Replacement resets \(r\) even when the new representative has the same value.