All about problems in Volume IV. If there is a thread about your problem, please use it. If not, create one with its number in the subject.
Moderator: Board moderators
by mahedee » Tue Jul 15, 2008 2:46 am
I tried this problem for several time but still getting WA. Could you please help me?
- Code: Select all
#include<stdio.h>
#include<string.h>
int main()
{
char str[500];
int i,j,val=0;
int len,flag =0;
while(gets(str)!=NULL)
{
//printf("\n");
len = strlen(str);
if(len==0)
{
printf("\n");
continue;
}
for(i = 0;i<len;i++)
{
if(str[i]>=48&&str[i]<=57)
{
val = val + (str[i]-48);
}
else
{
j = 0;
do
{
if(str[i]=='b')
printf(" ");
else if(str[i] == '!'||str[i] == '\n')
printf("\n");
else
printf("%c",str[i]);
j++;
}while(j<val);
val = 0;
}
}
printf("\n\n");
}
return 0;
}
Mahedee
-
mahedee
- New poster
-
- Posts: 3
- Joined: Sun Mar 23, 2008 1:29 pm
-
by sohel » Tue Jul 15, 2008 8:52 am
Do not create a new thread for a problem if one already exists!
-

sohel
- Guru
-
- Posts: 862
- Joined: Thu Jan 30, 2003 5:50 am
- Location: University of Texas at San Antonio
-
Return to Volume IV
Who is online
Users browsing this forum: No registered users and 1 guest