Python - Breaking Bad
► Problem Description:
In the intro for the television show Breaking Bad, the names of
the actors are shown with certain letters highlighted. The
highlighted letters are symbols from the periodic table of the
elements.
Here's a list
of those symbols and the corresponding element names.
Here is a video of Breaking Bad's intro.
Here are the actors' names along with their corresponding
periodic table symbols:
Actor Name | With Symbol | Symbol / Element |
---|---|---|
Bryan Cranston | Bryan (Cr)anston | (Cr = Chromium) |
Anna Gunn | A(Na)a Gunn | (Na = Sodium) |
Aaron Paul | Aaron (Pa)ul | (Pa = Protactinum) |
Dean Norris | Dean (N)orris | (N = Nitrogen) |
Betsy Brandt | Betsy B(Ra)ndt | (Ra = Radium) |
RJ Mitte | RJ Mit(Te) | (Te = Tellurium) |
Bob Odenkirk | Bob (O)denkirk | (O = Oxygen) |
Note that the same periodic table
symbol never appears in more than one name. For example, the
name "Bob Odenkirk" contains 'N' in addition to 'O' but
highlighting 'N' would be a repeat of that symbol ('N' was
already highlighted in "Norris").
Your task is to find *all* combinations of symbols that fit the
names above without any symbol being repeated. As an example,
here is an alternate solution to the one from the show's intro ...
Actor Name | With Symbol | Symbol / Element |
---|---|---|
Bryan Cranston | (Br)yan Cranston | (Br = Bromine) |
Anna Gunn | A(N)na Gunn | (N = Nitrogen) |
Aaron Paul | A(Ar)on Paul | (Ar = Argon) |
Dean Norris | Dean (No)rris | (No = Nobellium) |
Betsy Brandt | (Be)tsy Brandt | (Be = Beryllium) |
RJ Mitte | RJ M(I)tte | (I = Iodine) |
Bob Odenkirk | Bob Oden(K)irk | (K = Potassium) |
Display each solution on its own line, after you've shown all the solutions output the total number of solutions found.
► Example Output:
B, N, O, S, Be, Te, K B, N, O, S, Be, Te, I .... Ra, U, Pa, No, Ts, I, K Ra, U, Pa, No, Ts, I, Ir Total Solutions: 37595
► Source Code
All files (zip file)