Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. public static void main(String[] args) throws Exception
  2. {
  3. @SuppressWarnings("resource")
  4. Scanner inFile = new Scanner(new File("file.txt"));
  5.  
  6. // Read the number of vertices
  7. String line = inFile.nextLine();
  8. String[] data=line.split(",|\\s+");
  9. int part1=Integer.parseInt(data[0]);
  10. int part2=Integer.parseInt(data[1]);
  11.  
  12. while(inFile.hasNext())
  13. {
  14. line=inFile.nextLine();
  15. int index =0;
  16. int count=0;
  17. char edges = ',';
  18. while(index<line.length()) {
  19.  
  20. if(line.charAt(index)==edges){
  21. count++;
  22. }
  23. index++;
  24. }
  25.  
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement