import java.io.*;
class pro{
int n1,n2,nx;
int s,sx,datanumber;
String[] data=new String[50000];
String[] article=new String[50000];
int no,p1,p2,articlenumber;
String file,str,str1,str2;
public static void main(String args[]){
pro test=new pro();
}
pro(){
sx=0;
for(n1=13;n1<20;n1++){
nx=makenum(n1);
for(n2=1;n2<nx+1;n2++){
no=100*n1+n2;
file="data/";
file=file+no;
file=file+".txt";
readfile(file);
for(s=1;s<datanumber+1;s++){
str1="(";
p1=data[s].indexOf(str1);
if(p1>-1)sx=sx+1;
if(p1>-1)article[sx]=data[s];
if(p1<0)article[sx]=article[sx]+data[s];
}
articlenumber=sx;
System.out.println(articlenumber);
}
}
writefile("article.txt");
}
int makenum(int year){
int mk;
mk=35;
if(year==13)mk=35;
if(year==14)mk=42;
if(year==15)mk=30;
if(year==16)mk=35;
if(year==17)mk=31;
if(year==18)mk=31;
if(year==19)mk=10;
return mk;
}
void writefile(String str){
try{
PrintWriter pw = new PrintWriter
(new BufferedWriter(new FileWriter(str)));
for(s=1;s<articlenumber+1;s++){
pw.print(s);
pw.print(",");
pw.println(article[s]);
}
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年06月08日 16:57