for 2nd one
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
char str[100];
cin>>str;
char ch=str[0];
int count=0,i=0;
while(str[i])
{
if(str[i]==ch)
count++;
else
{
cout<<ch<<count;
ch=str[i];
count=1;
}
i++;
}
cout<<ch<<count;
getch();
}
On Thu, Sep 22, 2011 at 11:58 AM, rahul sharma <[email protected]>wrote:
> i found a question of ms earlier but know i not able to find
> it.....plz post link or thread ....
>
>
> i/p::a3b2c4:
> o/p:aaabbcccc
>
> i/p:aaabbc
> o/p:a3b2c1
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
*Dheeraj Sharma*
Comp Engg.
NIT Kurukshetra
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.