sorry :D
int RepChar(char *str)
{
int i,j;
int ret = -1;
int count[25];
for (i=0;i<25;++i) {
count[i]=0;
}
for (i=0;str[i];++i) {
j=str[i] - 'a';
count[j]++;
}
for (i=0;str[i];i++) {
if (count[i]==1) {
return ('a'+i);
}
}
return ret;
On Wed, Sep 28, 2011 at 8:10 PM, Shravan Kumar <[email protected]> wrote:
> @Sukran
>
> I guess it will return repeating character in alphabetical order but not in
> order of appearance in the i/p ??
>
>
> On Wed, Sep 28, 2011 at 8:04 PM, sukran dhawan <[email protected]>wrote:
>
>> int RepChar(char *str)
>> {
>> int i,j;
>> int ret = -1;
>> int count[25];
>>
>> for (i=0;i<25;++i) {
>> count[i]=0;
>> }
>> for (i=0;str[i];++i) {
>> j=str[i] - 'a';
>> count[j]++;
>> }
>> for (i=0;i<25;i++) {
>> if (count[i]==1) {
>> return ('a'+i);
>> }
>> }
>> return ret;
>>
>> }
>>
>> On Wed, Sep 28, 2011 at 7:57 PM, shady <[email protected]> wrote:
>>
>>> i will mail the code by tomorrow.
>>>
>>>
>>> On Wed, Sep 28, 2011 at 6:54 PM, Avenged <[email protected]> wrote:
>>>
>>>> Bump. Anybody?
>>>>
>>>> --
>>>> 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/-/on-DbSKUdzsJ.
>>>> 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.
>>>>
>>>>
>>> --
>>> 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.
>>>
>>
>> --
>> 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.
>>
>
> --
> 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.
>
--
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.