It is working Ukonen's algorithm.