K
keeponfalling
Guest
I need to count the number of duplicate chars in a string:
aabbcc :
-a - 2
-b - 2
-c - 2
or : aaab - - 2; b - 1;
Any hint please, I'm stuck. Thanks
I try this:
foreach(char c in p1)
{
int index = text.IndexOf(c);
if (c == text[index])
{
count++;
}
if(c != text[index])
{
countsinglenumbers++;
}
a++;
}
Continue reading...
aabbcc :
-a - 2
-b - 2
-c - 2
or : aaab - - 2; b - 1;
Any hint please, I'm stuck. Thanks
I try this:
foreach(char c in p1)
{
int index = text.IndexOf(c);
if (c == text[index])
{
count++;
}
if(c != text[index])
{
countsinglenumbers++;
}
a++;
}
Continue reading...