using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
var rx = "[a-zA-Z0-9]N[a-zA-Z0-9]{4}[0-9][a-zA-Z0-9]|([a-zA-Z0-9]{6}[0-9][a-zA-Z0-9])|[a-zA-Z0-9]{6}[a-zA-Z][a-zA-Z0-9]";
var results = Regex.Matches("BJX4700QHJ43EKU2KU89EJKM", rx)
.Cast<Match>()
.Where(m => !m.Groups[1].Success)
.Select(z => z.Value);
foreach (var s in results)
Console.WriteLine(s);
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLklPOwp1c2luZyBTeXN0ZW0uTGlucTsKdXNpbmcgU3lzdGVtLlRleHQuUmVndWxhckV4cHJlc3Npb25zOwoKcHVibGljIGNsYXNzIFRlc3QKewoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQoJewoJCSB2YXIgcnggPSAiW2EtekEtWjAtOV1OW2EtekEtWjAtOV17NH1bMC05XVthLXpBLVowLTldfChbYS16QS1aMC05XXs2fVswLTldW2EtekEtWjAtOV0pfFthLXpBLVowLTldezZ9W2EtekEtWl1bYS16QS1aMC05XSI7CgkJIHZhciByZXN1bHRzID0gUmVnZXguTWF0Y2hlcygiQkpYNDcwMFFISjQzRUtVMktVODlFSktNIiwgcngpCgkJICAgICAgICAgICAgLkNhc3Q8TWF0Y2g+KCkKCQkgICAgICAgICAgICAuV2hlcmUobSA9PiAhbS5Hcm91cHNbMV0uU3VjY2VzcykKCQkgICAgICAgICAgICAuU2VsZWN0KHogPT4gei5WYWx1ZSk7CiAgICAgICAgIGZvcmVhY2ggKHZhciBzIGluIHJlc3VsdHMpCiAgICAgICAgCUNvbnNvbGUuV3JpdGVMaW5lKHMpOwoJfQp9