Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Load
Dim a As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Dim g() As Char = a.ToCharArray
Dim MyRandom As New Random
Dim bs As String = ""
For i = 1 To 20
bs &= g(MyRandom.Next(0,g.GetUpperBound(0) + 1))
Next
Dim gs() As String = (From mt As Match In Regex.Matches(bs,"[A-Z]") Select mt.Value).ToArray
System.Array.Sort(gs)
gs = (From mt As Match In Regex.Matches(Join(gs,""),"([A-Z])1*") Select mt.Value).ToArray
Dim g_len() As Integer
g_len = (From mt As Match In Regex.Matches(Join(gs,""),"([A-Z])1*") Select mt.Length).ToArray ' 使用数组元素作为计数器g_len
System.Array.Sort(g_len,gs)
Label1.Text = "出现次数最多的字母:" & gs(gs.GetUpperBound(0)).Substring(0,1) & " 共出现" & g_len(g_len.GetUpperBound(0)) & "次" & vbCrLf & "没有出现的字母是:" & Join(a.Split(bs.ToCharArray),"")
End Sub
End Class