Answer in c# also help me.
I tried this code for if i have duplicate string in multiple arraylist it update and display in sequence as before.
maths
english
maths
hindi
english
science
Economics
scince
i need output like this
maths_1
english_1
maths_2
hindi
science_1
Economics
scince_2
i tried this code but output is not in sequence**
Dim subjectCounts As Dictionary(Of String, Integer) = New Dictionary(Of String, Integer)
For Each subject As String In arraysub
If subjectCounts.ContainsKey(subject) Then
subjectCounts(subject) = (subjectCounts(subject) + 1)
Else
subjectCounts.Add(subject, 1)
End If
Next
Dim output As List(Of String) = New List(Of String)
For Each pair As KeyValuePair(Of String, Integer) In subjectCounts
If (pair.Value > 1) Then
Dim i As Integer = 1
Do While (i <= pair.Value)
output.Add((i.ToString + ("_" + pair.Key)))
i = (i + 1)
Loop
Else
output.Add(pair.Key)
End If
Next