Longest NR substring using map