thanks for the code.....

On Wednesday, July 25, 2012 7:29:36 PM UTC+5:30, Navin Kumar wrote:
>
> logic is very simple ...just trace the program you will understand.
>
> On Wed, Jul 25, 2012 at 7:28 PM, Navin Kumar <algorithm.i...@gmail.com>wrote:
>
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <ctype.h>
>>
>> char *decrypt(char *s)
>> {
>>   int n;
>>   char *digit = (char *)malloc(sizeof(char) * 5);
>>   char *p1 = (char *)malloc(sizeof(char) * 1024);
>>   char *p = p1;
>>
>>   char *digit2;
>>   char  prev;
>>   prev =  *s;
>>
>>   *p++ = *s++;
>>
>>   while(s != '\0') {
>>       if(isdigit(*s)) {
>>           digit2 = digit;
>>           while(isdigit(*s)) 
>>               *digit2++ = *s++; 
>>           *digit2 = '\0';
>>           n = atoi(digit);
>>           while(n > 1) {
>>               *p++ = prev;
>>               n--;
>>
>>           }
>>       }
>>       prev = *s;
>>       if(*s != '\0')
>>             *p++ = *s++;
>>       else{
>>             *p = *s;
>>             break;
>>      }
>>
>>
>>   }
>>   *p = '\0';
>>   return p1;
>> }
>>
>> int main()
>> {
>>   char *s = "a10b10c1d3e4";
>>   char *s2 = decrypt(s);
>>
>>   printf("%s", s2);
>>   return 0;
>>
>> }
>>
>> On Wed, Jul 25, 2012 at 6:46 AM, Sathish babu <satbrucei...@gmail.com>wrote:
>>
>>> can anyone provide the code to convert ab1cd3 to  abcddd
>>> **~Sathish Babu~**
>>>
>>>
>>>
>>> On Tue, Jul 24, 2012 at 11:39 PM, Mind Boggler <min.b...@gmail.com>wrote:
>>>
>>>> Traditional decryption problem
>>>> Convert a3b2c5 into aaabbccccc
>>>> Can anyone Put forward an algo for the test case: a3b1c3d1
>>>> Thanx
>>>>
>>>> --
>>>> 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.
>>>
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/9Fbyh6FuJIoJ.
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