Programming 1

From Kyle's Wiki
Jump to: navigation, search

This challenge involves a wordlist and given a subset of scrambled letters. My job is to figure out what the original words were, in a very short time.

I solved this puzzle by presorting the given list into two collumns, the second being a scrambled version of the word in alphabetical order.

soleil : ,e,i,l,l,o,s,
sonics : ,c,i,n,o,s,s,
sophie : ,e,h,i,o,p,s,
spanish : ,a,h,i,n,p,s,s,
spanky : ,a,k,n,p,s,y,

Using grep I can match the given words with this premade word list with this script:

#!/bin/bash

#wget -q -O - http://www.hackthissite.org/missions/prog/1/ --load-cookies=../../.cookies.txt  | grep -A10 "List of scrambled" | tr " " "\n" | grep "li" | html2text
function reorganize {
        local s=""
        local i=""
        local COM=""
        local POS=""
        s=$1
                for i in $(seq 0 $((${#s} - 1)))
                do
                COM="$COM,${s:$i:1}"
                done
echo $COM | tr "," "\n" | sort | tr "\n" ","
}


cat p | tr -d "#" | tr -d [:blank:] > p2
for EACH in `cat p2`
do
grep $(reorganize $EACH) words

done

A list of all files I used and code: File:Prog1.zip

Personal tools
Namespaces

Variants
Actions
Efforts
Toolbox
Meta