Unscramble The Words ~ Writeup

author: k4m4
email: nikolaskam{at}gmail{dot}com
twitter: @NikolasKama

Name - Level 1
Type - Programming Mission
Level - Begginer [>]
Creator - HTS
Host - HackThisSite.org
Link - Try It Here

Brief Description

This level is about unscrambling words.

Find the original (unscrambled) words, which were randomly taken from a wordlist.<--
Send a comma separated list of the original words, in the same order as in the list below.

You have 30 seconds time to send the solution.
List of scrambled words:     anbdnor

As you can understand, we are primarily given a (pretty long) wordlist or dictionary if you like, as well as a list of scrambled words.

Our objective is obvious. We must find which original, 'unscrambled' word from the given wordlist matches which 'scrambled' word from the list, in the given time (of 30 seconds).

We are - lastly - asked to submit our output in comma-separated format - (Example: word1,word2,word3, ... word9,word10).

I bet you've already thought of a way to approach this easy task. No? Don't worry, I'll give you a hand.

The Code

You can use most languages to solve this challenge (e.g. ruby, java & python). Personally, I chose to use my, by far, favorite language - Python.

What I want Python to do for me is, firstly, read through the two lists and sort all strings alphabetically. Subsequently, I want it to iterate through each one of the scrambled words, and look for a match in the wordlist. Once a match is established, it will append the unscrambled form of the word to a list, and once all strings are matched, it displays the final list in comma-separated format (as requested by HTS).

Trust me. It's waay easier than it sounds.

Here is my final piece of code:

How To Use

I have purposely made this python script short and simple. Additionally, I've made it incredibly easy to use:

  1. Download the ZIP file from Github Gist.
  1. Paste your list of scrambled words into the scrambled.txt file. (Overwrite the original file, and replace its contents with your scrambled words.)
  1. Run the python file using either your compiler (e.g. IDLE or Atom), or by simply executing it through terminal: $ python scrambled.py. (If you're using terminal, make sure you are in the right directory.)
  1. Submit the comma-separated output to the HackThisSite website by copying and pasting it to the Answer: form of Level 1.

Congrats Lvl 1

Woo-hoo! Piece of cake, wasn't it?

Stay put. More coming!

k4m4 from