Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, mycount Do Input #1, strr If strr <> "" Then Do For i = 1 To Len(strr) If Asc(Mid(strr, i, 1)) < 0 Then strr = Replace(strr, Mid(strr, i, 1), ""): ans = ans + 1: Exit For If Asc(Mid(strr, i, 1)) > 0 Then strr = Replace(strr, Mid(strr, i, 1), ""): Exit For Next Loop Until Len(strr) = 0 Print #2, ans ans = 0 End If Loop Until EOF(1) Close #2 Close #1 End End Sub
Dim sum As Integer Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, n Do Input #1, a lon = Len(a) For j = 1 To lon an = Mid(a, j, 1) If Asc(an) < 1 Then a = Replace(a, an, "9") sum = sum + 1 End If Next If sum > 0 Then Print #2, sum sum = 0 Loop Until EOF(1) Close #2 Close #1 End End Sub
Dim a() As String Private Sub Form_Load() Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, n For c = 1 To Val(n + (n - 1)) ans = 0 Line Input #1, x If x <> "" Then ReDim a(Len(x)) For i = 1 To Len(x) If Asc(Mid(x, i, 1)) < 0 Then a(i) = Mid(x, i, 1) Next i For i = 1 To Len(x) For j = i + 1 To Len(x) If a(i) = a(j) Then a(j) = "" Next j Next i For i = 1 To Len(x) If a(i) <> "" Then ans = ans + 1 Next i Print #2, ans End If Next c Close #2 Close #1 End End Sub
Private Sub Form_Load()
回覆刪除Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, mycount
Do
Input #1, strr
If strr <> "" Then
Do
For i = 1 To Len(strr)
If Asc(Mid(strr, i, 1)) < 0 Then strr = Replace(strr, Mid(strr, i, 1), ""): ans = ans + 1: Exit For
If Asc(Mid(strr, i, 1)) > 0 Then strr = Replace(strr, Mid(strr, i, 1), ""): Exit For
Next
Loop Until Len(strr) = 0
Print #2, ans
ans = 0
End If
Loop Until EOF(1)
Close #2
Close #1
End
End Sub
Dim sum As Integer
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, n
Do
Input #1, a
lon = Len(a)
For j = 1 To lon
an = Mid(a, j, 1)
If Asc(an) < 1 Then
a = Replace(a, an, "9")
sum = sum + 1
End If
Next
If sum > 0 Then Print #2, sum
sum = 0
Loop Until EOF(1)
Close #2
Close #1
End
End Sub
Dim a() As String
回覆刪除Private Sub Form_Load()
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, n
For c = 1 To Val(n + (n - 1))
ans = 0
Line Input #1, x
If x <> "" Then
ReDim a(Len(x))
For i = 1 To Len(x)
If Asc(Mid(x, i, 1)) < 0 Then a(i) = Mid(x, i, 1)
Next i
For i = 1 To Len(x)
For j = i + 1 To Len(x)
If a(i) = a(j) Then a(j) = ""
Next j
Next i
For i = 1 To Len(x)
If a(i) <> "" Then ans = ans + 1
Next i
Print #2, ans
End If
Next c
Close #2
Close #1
End
End Sub