  Given two finite words $u$ and $v$ of equal length, define the \emph{overlap
gap between $u$ and $v$}, denoted $og(u,v)$, as the least integer $m$ for which
there exist words $x$ and $x'$ of length $m$ such that $xu=vx'$ or $ux=x'v$.
Informally, the overlap gap measures the outside parts of the greatest overlap
of the given words.
  For a left-infinite word $\lambda$ and a right-infinite word $\rho$, let
$og_{\lambda,\rho}$ be the function defined, for each non-negative integer $n$,
by $og_{\lambda,\rho}(n)=og(\lambda_n,\rho_n)$, where $\lambda_n$ and $\rho_n$
are, respectively, the suffix of $\lambda$ and the prefix of $\rho$ of length
$n$. Also, denote by $OG_{\lambda,\rho}$ the image of the function
$og_{\lambda,\rho}$.
  In this paper, we show that $OG_{\lambda,\rho}$ is a finite set if and only
if $\lambda$ and $\rho$ are ultimately periodic infinite words of the form
$\lambda=u^{-\infty}w_1=\cdots uuuw_1$ and $\rho=w_2u^\infty=w_2uuu\cdots$ for
some finite words $u$, $w_1$ and $w_2$.
