fork download
  1. Imports System
  2.  
  3. Public Class Test
  4. Public Shared Sub Main()
  5. Function GetTopLevelAreas(areas As String) As String
  6. Dim topLevelAreas = New System.Collections.Generic.List(Of String)()
  7. Dim areasList = New System.Collections.Generic.List(Of String)()
  8.  
  9. Dim areasCollection = areas.Split(","C)
  10.  
  11. For Each area As String In areasCollection
  12. areasList.Add(area)
  13. Next
  14.  
  15. While areasList.Count > 0
  16. For Each topLevelArea As String In GetCurrentTopLevelAreas(areasList)
  17. topLevelAreas.Add(topLevelArea)
  18.  
  19. For i As Integer = areasList.Count - 1 To 0 Step -1
  20. If areasList(i).StartsWith(topLevelArea) Then
  21. areasList.Remove(areasList(i))
  22. End If
  23. Next
  24. Next
  25. End While
  26.  
  27. Dim str = String.Empty
  28.  
  29. For Each topLevelArea As String In topLevelAreas
  30. str += topLevelArea + ","
  31. Next
  32.  
  33. Return str.Remove(str.LastIndexOf(","))
  34. End Function
  35.  
  36. Function GetCurrentTopLevelAreas(areas As System.Collections.Generic.List(Of String)) As System.Collections.Generic.List(Of String)
  37. Dim currentTopLevelAreas = New System.Collections.Generic.List(Of String)()
  38. Dim min = 0
  39.  
  40. For Each area As String In areas
  41. Dim count = area.Split("\"C).Length - 1
  42.  
  43. If min = 0 Then
  44. min = count
  45. ElseIf count < min Then
  46. min = count
  47. End If
  48. Next
  49.  
  50. For Each area As String In areas
  51. If area.Split("\"C).Length - 1 = min Then
  52. currentTopLevelAreas.Add(area)
  53. End If
  54. Next
  55.  
  56. Return currentTopLevelAreas
  57. End Function
  58.  
  59. End Sub
  60. End Class
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Visual Basic.Net Compiler version 0.0.0.5914 (Mono 2.4.2 - r)
Copyright (C) 2004-2008 Rolf Bjarne Kvinge. All rights reserved.


/home/9llP0H/prog.vb (5,28) : Error VBNC90019: Expected 'End'.
Error recovery not implemented yet.
/home/9llP0H/prog.vb (5,28) : Error VBNC30205: Expected end of statement.
Error recovery not implemented yet.
/home/9llP0H/prog.vb (59,9) : Error VBNC90019: Expected 'Class'.
Error recovery not implemented yet.
/home/9llP0H/prog.vb (59,9) : Error VBNC30205: Expected end of statement.
Error recovery not implemented yet.
/home/9llP0H/prog.vb (59,9) : Error VBNC30203: Not valid as identifier.
/home/9llP0H/prog.vb (60,10) : Error VBNC30203: Not valid as identifier.
There were 6 errors and 0 warnings.
Compilation took 00:00:00.6880140
stdout
Standard output is empty