Let a and b be closed curves on a compact hyperbolic surface. We propose an efficient algorithm for detecting whether they are of the same type.