Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how can i return string by vilating duplicates(inpyt like
asdfsda but output should be 2a2d2sf and 2a,2d,2s,f)

Answer Posted / hari

we can modify the previous answer to make it efficient...
check it..

string x = "asdfsdaaasasa";
string output = "";
int count = 0;
IEnumerator ie = x.GetEnumerator();
IEnumerator iee = x.GetEnumerator();
while(ie.MoveNext())
{
if (!output.Contains(ie.Current.ToString()))
{
while(iee.MoveNext())
{
if ((char)ie.Current == (char)iee.Current)
{
count++;
}
}
iee.Reset();
output = output + count + ie.Current;
count = 0;
}
}
Console.WriteLine(output);

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a streamwriter in c#?

876


Define multicast delegate in c#?

895


What is main thread in c#?

871


what are some characteristics of an array?

906


What is the name of c# compiler?

1090


What is the difference between decimal and integer?

1025


What is difference between iqueryable and ienumerable in c#?

834


What is datagridview in c#?

1080


Which function is the entry point for a DLL in MS Windows 3.1?

1113


Is post back in c#?

914


What is Asynchronous call and how it can be implemented using delegates?

960


Can we extend sealed class in c#?

875


What does using system mean in c#?

966


What is appdomain in c#?

848


Does c# provide copy constructor?

965