Click here to Skip to main content
12,998,654 members (130,831 online)
Rate this:
Please Sign up or sign in to vote.
See more:
given a string SSSEERRTADEEE write a program to output the following way to given string:S3E2R2T1A1D1E3

please what will be the logic to above probl C# in c#.Hope anyone must give me the waiting for your reply...
Posted 5-Feb-13 17:13pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You can use the code below:

private static void GetCharCountInString()
            const string strOriginal = "SSSEERRTADEEE";
            string strNew = string.Empty;
            int index = 0;
            char[] chararray = strOriginal.ToCharArray();

            for (index = 0; index < chararray.Length; index++)
                int charCount = 1;
                int firstindex = index;
                int flag = 0;
                while (index != strOriginal.Length - 1 & flag == 0)
                    if (chararray[index].CompareTo(chararray[index + 1]) == 0)
                        flag = 0;
                        flag = 1;
                strNew += chararray[firstindex].ToString(CultureInfo.InvariantCulture) +
            Console.WriteLine("Original : {0}\n New : {1}", strOriginal, strNew);

Happy Coding :)
Aurovinda shyamal 6-Feb-13 7:28am
Hi SruthiR
This code is working fine.Thanks for your time given....
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

string s = // ...
// ...
    s = "S3E2R2T1A1D1E3";
//... :-)

It should give you the following idea: if you provided some example of data on input and output, it does not mean you formulated the problem.

The question does not really make any sense.

Good luck,
Aurovinda shyamal 6-Feb-13 1:36am
Hi Sergy
If you don't know the answer, please avoid,the question but don't give any negative comment about any one's question.Its my requirement..I need it... very urgent.
It cannot be urgent, because you apparently don't know what you want. About negative comment... it's not even rude, just ignorant. My answer is accurate enough, you just fail to see it.
skydger 6-Feb-13 2:21am
Fair enough.
My 5 xD
Thank you. :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 6 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100