import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class HelloWorld {
public static void main (String[] args){
BufferedReader br = null;
BufferedWriter bw = null;
try {
br = new BufferedReader(new FileReader("test.txt"));
List list = new ArrayList();
String temp = null;
while((temp = br.readLine()) != null){
list.add(temp);
}
if(list.size() <= 0){
return ;
}
String a[][] = new String[list.size()][];
for (int i = 0; i < list.size(); i++) {
String aa = list.get(i);
a[i] = aa.split(",");
}
bw = new BufferedWriter(new FileWriter("newtest.txt"));
for (int i = 0; i < a.length; i++) {
temp = "";
for (int j = 0; j < a[i].length; j++) {
temp += a[i][j] + "a,";
}
temp = temp.substring(0, temp.length() - 1);
bw.write(temp);
bw.newLine();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if(br != null)
br.close();
if(bw != null)
bw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}