using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main(string[] args)
{
new Program().Run();
}
void Run()
{
string line;
while ((line = Console.ReadLine()) != null)
{
var parts = line.Split('-');
RunTest(parts[0], parts[1]);
}
}
void RunTest(string start, string end)
{
if (start.Length != end.Length)
throw new ArgumentException();
Console.WriteLine("Testing range: {0}-{1}", start, end);
var results = GetPatterns(start, end);
foreach(var pattern in results)
Console.WriteLine(pattern);
}
IEnumerable<string> GetPatterns(string start, string end)
{
if (start.Length == 0)
{
yield return "";
yield break;
}
var startPrefix = start.Substring(0, start.Length - 1);
var endPrefix = end.Substring(0, end.Length - 1);
var startSuffix = start.Last();
var endSuffix = end.Last();
var rec = GetPatterns(startPrefix, endPrefix).ToList();
for (int i = 0; i < rec.Count; i++)
{
char startDigit = (i == 0) ? startSuffix : '0';
char endDigit = (i == rec.Count - 1) ? endSuffix : '9';
if (startDigit == '0' && endDigit == '9')
{
yield return rec[i] + '*';
}
else
{
for (var digit = startDigit; digit <= endDigit; digit++)
yield return rec[i] + digit;
}
}
}
}