fork download
  1. import java.io.*;
  2. import java.util.*;
  3.  
  4. public class Main {
  5.  
  6. /**
  7.   * @param args
  8.   * @throws FileNotFoundException
  9.   * @throws FileNotFoundException
  10.   * @throws FileNotFoundException when the file cannot be loaded
  11.   */
  12.  
  13. public static void main(String[] args) throws IOException{
  14.  
  15. String hteam = "";
  16. String ateam = "";
  17. int hscore = 0;
  18. int ascore = 0;
  19.  
  20. Scanner s = new Scanner(System.in).useDelimiter("\\s*:\\s*|\\n");
  21. // create a scanner which scans from a file and splits at each colon
  22.  
  23. while ( s.hasNext() ) {
  24.  
  25. hteam = s.next(); // read the home team from the file
  26. ateam = s.next(); // read the away team from the file
  27. hscore = s.nextInt(); //read the home team score from the file
  28. ascore = s.nextInt(); //read the away team score from the file
  29.  
  30. System.out.print(hteam); // output the line of text to the console
  31. System.out.print(hscore);
  32. System.out.print(ateam);
  33. System.out.println(ascore);
  34. }
  35. System.out.println("\nEOF"); // Output and End Of File message.
  36. }
  37. }
Success #stdin #stdout 0.11s 381760KB
stdin
Leeds United : Liverpool : 1 : 2
Chelsea : Manchester City : 1 : 1
Aston Villa : Middlesbrough : 3 : 1
Tottenham Hotspur : Stoke City : 0 : 0
West Ham United : Wigan Athletic : 2 : 1
Fulham : Liverpool : 1 : 2
Wigan Athletic : Leeds United : 2 : 2
Hull City : Tottenham Hotspur : 3 : 5
Everton : Portsmouth : 4 : 2
Stoke City : West Bromwich Albion : 5 : 4
Blackburn Rovers : Fulham : 1 : 1
West Ham United : Newcastle United : 0 : 0
Manchester United : Wigan Athletic : 1 : 2
Hull City : Sunderland : 2 : 3
Fulham : Leeds United : 1 : 2
Wigan Athletic : Tottenham Hotspur : 2 : 2
Hull City : Everton : 3 : 5
Sunderland : Blackburn Rovers : 4 : 2
Stoke City : West Bromwich Albion : 5 : 4
Blackburn Rovers : Fulham : 1 : 1
Sunderland : Newcastle United : 0 : 0
Sunderland : Blackburn Rovers : 1 : 2
Hull City : Everton : 2 : 3
Leeds United : Chelsea : 1 : 2
Chelsea : Manchester City : 1 : 1
Aston Villa : Fulham : 3 : 1
Manchester City : Stoke City : 0 : 0
West Ham United : Middlesbrough : 2 : 1
stdout
Leeds United1Liverpool2
Chelsea1Manchester City1
Aston Villa3Middlesbrough1
Tottenham Hotspur0Stoke City0
West Ham United2Wigan Athletic1
Fulham1Liverpool2
Wigan Athletic2Leeds United2
Hull City3Tottenham Hotspur5
Everton4Portsmouth2
Stoke City5West Bromwich Albion4
Blackburn Rovers1Fulham1
West Ham United0Newcastle United0
Manchester United1Wigan Athletic2
Hull City2Sunderland3
Fulham1Leeds United2
Wigan Athletic2Tottenham Hotspur2
Hull City3Everton5
Sunderland4Blackburn Rovers2
Stoke City5West Bromwich Albion4
Blackburn Rovers1Fulham1
Sunderland0Newcastle United0
Sunderland1Blackburn Rovers2
Hull City2Everton3
Leeds United1Chelsea2
Chelsea1Manchester City1
Aston Villa3Fulham1
Manchester City0Stoke City0
West Ham United2Middlesbrough1

EOF