Page 2 of 2

Posted: Tue Dec 17, 2013 4:30 pm
by dut
fast and dirty :oops:

Code: Select all

 
f = open('rfc3280.txt')
words = []
for line in f:
    temp = line.split()
    for item in temp:
        if len(item) == 9:
            words.append(item)

for item in words:
    print item, words.count(item)
python rfc3280.py | sort -k2 -n -u | tail -n1

Posted: Wed Feb 04, 2015 2:56 am
by polocatfan
Oh was I not supposed to bruteforce it?

I typed [a-zA-Z]{9} into notepad++'s marking search function and bruteforced it :lol:

Posted: Mon Nov 23, 2015 1:28 am
by adark
I'm really enjoying these. ^.^

Lua

Code: Select all

local file = io.open("rfc3280.txt")
local t = string.lower(file:read("*all"))
file:close()


local wrd, maxcount = "", 0

for word in t:gmatch("%a+") do
	if #word == 9 then

		local count = 0
		for _ in t:gmatch(word) do
			count = count + 1
		end
		if count > maxcount then
			wrd = word
			maxcount = count
		end
	end
end

Posted: Mon Nov 23, 2015 5:10 am
by AMindForeverVoyaging
adark wrote:I'm really enjoying these. ^.^
Then wait until the hard challenges kick in :wink:

Welcome to these forums.

Posted: Thu Dec 31, 2015 1:34 am
by 06kellyjac
FlippyDeath wrote:I entered the first nine letter word I could find in the text and it was right...

My luck...
Similar to you, I saw that it was repeated a load of times so I counted its length and it was 9

Posted: Sun May 14, 2017 3:53 pm
by daleonpz
I use this oneliner:



cat rfc3280.txt | sed 's/[,.\r]//g' | tr ' ' '\n' | sort | uniq -c | awk '{ print $1 "\t" length($2) "\t" $2}' | awk '$2==9' | sort -k1 -n | tail -1