Private Sub Command1_Click()
Dim s As String, ch As String
Dim i As Integer, n As Integer
Dim max1 As Integer, max2 As Integer
s = Text1.Text: n = Len(Text1.Text)
If Mid(s, 1, 1) > Mid(s, 2, 1) Then
max1 = 1: max2 = 2
Else
max1 = 2: max2 = 1
End If
For i = 3 To n
ch = Mid(s, i, 1)
If ch > Mid(s, max1, 1) Then
max1 = i
ElseIf ch >= Mid(s, max2, 1) Then
max2 = i
End If
Next i
For i = 1 To n
If Then Text2.Text = Text2.Text & Mid(s, i, 1)
Next i
End Sub