I have format LLNLN where L is Letter and N is number.
How can I print all possible strings, that match that format?
The output I'm expecting is
AA0A0
AA0A1
...
AA0A8
AA0A9
AA0B0
AA0B1
...
ZZ9Z9
I have format LLNLN where L is Letter and N is number.
How can I print all possible strings, that match that format?
The output I'm expecting is
AA0A0
AA0A1
...
AA0A8
AA0A9
AA0B0
AA0B1
...
ZZ9Z9
You can do it with LINQ for example:
var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var numbers = "0123456789";
var mutations =
from m0 in letters
from m1 in letters
from m2 in numbers
from m3 in letters
from m4 in numbers
select "" + m0 + m1 + m2 + m3 + m4;
foreach (var mutation in mutations)
{
Console.WriteLine(mutation);
}
I would write something like this (C#)
string Letters = "ABCDEFGHIJKLMNOPQRSTUVYZ";
foreach (Char l1 in Letters)
foreach (Char l2 in Letters)
for (int n1=0;n1 < 10;n1++)
foreach (Char l3 in Letters)
for (int n2=0;n2 < 10;n2++)
Console.WriteLine(l1.ToString()+
l2.ToString()+
n1.ToString()+
l3.ToString()+
n2.ToString());