Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.ArrayList;
- /*
- * 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 Attila
- */
- public class TuraStat {
- public static void main(String[] args) throws FileNotFoundException, IOException {
- // BufferedReader Console = new BufferedReader(new FileReader("sample.txt"));
- BufferedReader Console = new BufferedReader(new InputStreamReader(System.in));
- String line;
- ArrayList<String> TuraList = new ArrayList<String>();
- while((line = Console.readLine()) != null){
- if(!line.contains(":")){
- if(TuraList.contains(line)){
- while(TuraList.contains(line)){
- TuraList.remove(TuraList.indexOf(line));
- }
- }else TuraList.add(line);
- }
- }
- TuraList.sort((o1, o2) -> {
- return o1.compareTo(o2);
- });
- for (String string : TuraList) {
- System.out.println(string);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement