for 1st
#includeiostream
#includevector
using namespace std;
int main()
{
char c;
string s;
int n;
vector char ans;
cins;
int i=0;
while(s[i]!='\0')
{
c=s[i];
n=s[i+1]-'0';
while(n--)
ans.push_back(c);
i+=2;
}
2nd
#includeiostream
#includevector
using namespace std;
int main()
{
string s;
cins;
int i=0,count=1;
vectorint no;
vectorchar c;
while(s[i]!='\0')
{
if(s[i]==s[i+1])
count++;
else
{
c.push_back(s[i]);
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:aaabb
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
for 2nd one
#includeiostream
#includeconio.h
using namespace std;
int main()
{
char str[100];
cinstr;
char ch=str[0];
int count=0,i=0;
while(str[i])
{
if(str[i]==ch)
count++;
else
{
for 1st
#includeiostream
#includeconio.h
#includestring.h
using namespace std;
int main()
{
char str[100];
cinstr;
int len=strlen(str);
int i=1;
while(ilen)
{
int x=str[i]-48;
while(x--)
coutstr[i-1];
i+=2;