Pagini recente » Cod sursa (job #3198444) | Cod sursa (job #180499) | Cod sursa (job #188078) | Cod sursa (job #2964968) | Cod sursa (job #1359675)
import java.io.*;
import java.util.*;
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Roxana Capitanu
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
String allText = "", line;
// String head;
//String list[];
BufferedReader br;
br = new BufferedReader(new FileReader("convertor.in"));
BufferedWriter bw = new BufferedWriter(new FileWriter("convertor.out"));
while ((line = br.readLine()) != null){
allText += line;
}
int len, i;
len = allText.split("\\{")[1].split(",").length;
for (i = 0; i < len - 1; i ++)
bw.write(allText.split("\\{")[1].split(",")[i].split(":")[0].split("\"")[1] + ",");
bw.newLine();
String str;
len = allText.split("\\{").length;
for (i = 1; i < len; i ++){
for (String s : allText.split("\\{")[i].split(",")){
if (s.split(":").length > 1)
{
if (s.split(":")[1].split("\"").length > 1)
bw.write(s.split(":")[1].split("\"")[1] + ",");
else
bw.write(s.split(":")[1].replaceAll(" ", "").replaceAll(",","") + ",");
}
// else System.out.println(s + "i");
bw.newLine();
}
}
br.close();
bw.close();
}
}