ABC Problem


Collapse Content

You are given a collection of ABC blocks. Just like the ones you had when you were a kid. There are twenty blocks with two letters on each block. You are guaranteed to have a complete alphabet amongst all sides of the blocks. The sample blocks are:

((B O)
(X K)
(D Q)
(C P)
(N A)
(G T)
(R E)
(T G)
(Q D)
(F S)
(J W)
(H U)
(V I)
(A N)
(O B)
(E R)
(F S)
(L Y)
(P C)
(Z M))

The goal of this task is to write a function that takes a string and determines whether you can spell the word with the given collection of blocks. Once a letter on a block is used that block cannot be used again for that word.

For example, you can make the word "BARK" with the blocks, but it's imossible to make the word "BOOK".

Challenge

Print true if a given word of input that can be written with the blocks, and false otherwise.

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

Contact Us