All pastes #957491 Raw Edit

Unnamed

public text v1 · immutable
#957491 ·published 2008-03-26 00:49 UTC
rendered paste body
import java.io.*;

public class Descramble {
	
	public String text;
	public static String words[] = new String[10];
	public static int[] wordValues = new int[10];
	public static String[] wordlist = new String[2000]; 
	public static int a=0, n=0; 
	FileReader fileReader = null;
	static BufferedReader bufReader = null; 
	public static void main(String args[]) throws IOException {
	try {
		bufReader = new BufferedReader (new FileReader("wordlist.txt"));
	}
	catch (Exception e) {
	System.out.println ("File not found.\n");
	}
		for(int c=0; c<10; c++) {
			if(c==0) {
				words[c]=SavitchIn.readLine().substring(2);
			}
			else {
			words[c]=SavitchIn.readLine().substring(3);
			}
			System.out.println(words[c]);
			for(int t=0; t<words[c].length(); t++) {
				System.out.println(words[c].charAt(t));
				wordValues[c]+=(int)words[c].charAt(t);
			}
		}
		boolean found;
		String line ="";
	while( (line = bufReader.readLine()) != null) {
		wordlist[n]=line;
		n++;
	}
	while(a<10) {
		found = false;
		while(!found) {
		for(int y=0; y<n; y++) {
			if(wordlist[y].length()==words[a].length()) {
				int checksum =0;
				for(int d=0; d<wordlist[y].length(); d++) {
					checksum+=(int)wordlist[y].charAt(d);
				}
				if(checksum==wordValues[a]) {
					a++;
					found = true;
					System.out.println(line + ",");
				}
			}
		}
		}
	}
	}
}
Input and output:
# tiekrm
# 	logbyoi
# 	rraowir
# 	eolcewm
# 	tntinere
# 	eoprlxer
# 	sahewl
# 	cccccc
# 	iantsu
# 	lecogletiekrm
t
i
e
k
r
m
logbyoi
l
o
g
b
y
o
i
rraowir
r
r
a
o
w
i
r
eolcewm
e
o
l
c
e
w
m
tntinere
t
n
t
i
n
e
r
e
eoprlxer
e
o
p
r
l
x
e
r
sahewl
s
a
h
e
w
l
cccccc
c
c
c
c
c
c
iantsu
i
a
n
t
s
u