add regexpre
longest path in directed acyclic graph
update longest substr without duplicate