The Lsharp algorithm for DFAs