Hamza wants to add a new concept to the arrays world. The new concept is called "The good segment", which is the segment where its first element is equal to the last one.
Practically, for any array with size $n$, the segment $a_l , a_{l+1} , a_{l+2} , … , a_{r}$ is called good segment if $a_l = a_r$.
Hamza wants to experience your understanding of this concept by giving you an array with size $n$ and asking you to find the longest $k$-good segment.