import java.util.Arrays; import java.util.ArrayList; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; class Fagylalt { private final String[] gombócok; @Override public String toString() { return Arrays.toString(gombócok).replaceAll("[\\[\\]]", ""); } } public class Teszt { public static void main(String[] args) { ArrayList fal = new ArrayList<>(); try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { String sor = null; while ((sor = br.readLine()) != null) { String[] st = sor.split(";"); fal.add(new Fagylalt(st)); } } catch (IOException ioe) { ioe.printStackTrace(); } Fagylalt[] ft = fal.toArray(new Fagylalt[0]); for (Fagylalt f : ft) { System.out.println(f); } System.out.println(); Fagylalt.kiírGombócSzámSzerintRendezve(ft); System.out.println(); Fagylalt.kiírGombócNevekHosszainakÖsszegeSzerintRendezve(ft); } }