Vanity number plates PCOD

Vanity number plates were once reserved only for the rich, but now, almost anybody can get a number plate that spells out names, professions etc, sometimes using numbers to replace letters.

Today’s challenge is a fairly straight-forward one. Given a word, you must create a program that will return a list of number plates that match the word. To make it a little easier, the plates must match the word exactly, with no extra letters/numbers in them.

The number plates must match the 1983-2001 format (eg. A21 AAA to Y999 YYY). We are ignoring the new (current) format as it is over complicated for this challenge (if anyone wants to extend it to output new plates as well, feel free, but it must match the format exactly).

There are a few other rules:

  • The letters I, O, U and Z cannot be used as the first letter
  • 1 can be treated as I or L
  • 2 can be treated as Z
  • 3 can be treated as E
  • 4 can be treated as A
  • 5 can be treated as S
  • 7 can be treated as T
  • 8 can be treated as B
  • 9 can be treated as G
  • 0 can treated as O
  • The output should include the space.

As usual, your program should expose a single function or class method. You can write it in any language you’re comfortable with. Here are some words to test your function:

  • RETINA
  • MALICE
  • MELODY
  • GLOBULE
  • STIGMA
  • KISSING
  • LOOTING

Due to the format of the plate and because we are only returning exact matches, we can expect that only 6 and 7 letter words are going to work with this function.

Go!

Leave a Reply