Here..
1. if continuous spaces are occurring even times- let 2n time then it
replaces every second space with '\b'(backspace)

2.   if continuous spaces are occurring even times- let 2n+1 time then for
first 2n spaces it replaces every second space with '\b'(backspace) and
last space gets replaced by '\a'(alert character).

So in this way reducing no of alert characters('\a')...and spaces are
removed by help of '\b' character...

On Thu, Aug 2, 2012 at 7:51 PM, Daksh Talwar <dakshtal...@gmail.com> wrote:

> ^ : I guess this is the only in-place method.
> It prevents the space from being printed.
> does not 'remove' it though ; just replaces with a bell sound !
>
>
> On Wed, Aug 1, 2012 at 11:12 PM, atul pandey <atulpande...@gmail.com>wrote:
>
>> Geeks just look at this...correct me if i am wrong...!!
>>
>> int main()
>> {
>>     char s[] = "how      are  you    friends";
>> int i=0;
>>  while(s[i] != '\0')
>> {
>> if(s[i] == ' ' && s[i+1]==' ')
>>  { s[i+1] = '\b';  i++; }
>> else if(s[i]== ' ') s[i]='\a';
>>  i++;
>> }
>> printf("%s\n", s);
>>     }
>>
>> On Wed, Aug 1, 2012 at 5:01 PM, atul anand <atul.87fri...@gmail.com>wrote:
>>
>>> j=0;
>>> for i to len
>>>    if(str[i] != '   ' )
>>>    {
>>>      str[j]=str[i];
>>>       j++;
>>>    }
>>> end
>>> str[j]='\0';
>>>
>>> On Wed, Aug 1, 2012 at 10:08 AM, Sambhavna Singh <
>>> coolsambha...@gmail.com> wrote:
>>>
>>>> Please have a look at this :
>>>> http://www.careercup.com/question?id=14433699&utm_source=feedburner&utm_medium=email&utm_campaign=Feed%3A+Careercup+%28CareerCup%29
>>>>
>>>> What does inplace shifting imply here? Cant i keep 2 pointers and
>>>> overwrite a non space character onto a space character and advance both
>>>> pointers till one again hits a space character and other a non-space
>>>> character? Does that violate the condition given in the question?
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Thanks & Regards,
>> * Atul Kumar Pandey*
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> - - - - - - - - - - - -
> With Regards
> Daksh Talwar
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Thanks & Regards,
* Atul Kumar Pandey*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to