import java.io.*;
class avex{
String[] data=new String[50000];
String[] dic=new String[50000];
String[] word=new String[200];
int[] p=new int[200];
int page,s,sx,sxs,datanumber;
int dicnumber;
int[][] num=new int[300][30000];
int[][] nx=new int[300][200];
int tx;
String str,file;
public static void main(String[] args){
avex test=new avex();
}
avex(){
readfile("adata.txt");
for(s=1;s<datanumber+1;s++){;
String[] x=data[s].split(">");
for(sx=0;sx<x.length;sx++){
str=x[sx].replace("<","");
num[s][sx+1]=Integer.parseInt(str);
}
}
readfile("word.txt");
for(s=1;s<101;s++){
word[s]=data[s];
}
readfile("dic.txt");
for(s=1;s<datanumber+1;s++){
dic[s]=data[s];
}
for(s=1;s<101;s++){
sxs=0;
for(sx=1;sx<datanumber+1;sx++){
if(word[s].equals(dic[sx]))sxs=sx;
}
p[s]=sxs;
}
for(s=1;s<220;s++){
for(sx=1;sx<101;sx++){
tx=p[sx];
nx[s][sx]=num[s][tx];
}
}
writefile();
}
void writefile(){
int s,sx;
try{
PrintWriter pw = new PrintWriter
(new BufferedWriter(new FileWriter("avex.txt")));
for(s=1;s<220;s++){
for(sx=1;sx<100;sx++){
pw.print("<");
pw.print(nx[s][sx]);
pw.print(">");
}
pw.print("<");
pw.print(nx[s][100]);
pw.println(">");
}
System.out.println("ファイルに書きこみました。");
pw.close();
}
catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
void readfile(String file){
String str;
BufferedReader br;
int s;
s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"SJIS"));
while((str = br.readLine()) != null) {
s=s+1;
data[s]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;
}
}
最終更新:2011年07月13日 11:10