int a[256] = {0};
int i;
for(i=0;str[i];i++)
a[str[i]]++;
for(i=0;str[i];i++)
{
if(a[str[i]] == 1)
{
printf("%c",str[i]);
break;
}
}
hope i am clear
On Sun, Sep 11, 2011 at 5:56 PM, Ishan Aggarwal <
[email protected]> wrote:
> How will it work>?
>
>
> On Sun, Sep 11, 2011 at 5:53 PM, sukran dhawan <[email protected]>wrote:
>
>> 1.use character count to record frequencey of occurences // initialise
>> array to 0
>> 2. for(i=0;str[i];i++)
>> {
>> if(count[str[i]] == 0) // first repeated character break;
>> }
>>
>> On Sun, Sep 11, 2011 at 5:43 PM, Ishan Aggarwal <
>> [email protected]> wrote:
>>
>>> {Please solve the following questions :-
>>>
>>> 1.) Find first non repeated character.
>>>
>>> eg. total --> o
>>> teeter --> r
>>>
>>> 2.) Remove specified letters from a string.
>>>
>>> input --> "Battle of the vowels: Hawaii vs. Gronzy" , "aeiou"
>>>
>>> output --> "Bttle f th vwls: Hw vs. Grnzy"
>>>
>>> What is the problem in this solution ... Its giving compilation error.
>>>
>>>
>>> #include<stdio.h>#include<string.h>
>>> void main(){int temp1[256];int i=0;char str[40] = "Battle of the vowels:
>>> Hawaii vs. Gronzy";char temp[6] = "aeiou";
>>> for(i=0;i<256;i++)
>>> temp1[i] = 0;
>>>
>>> i=0;while(temp[i]){
>>> temp1[temp[i]] = 1;
>>> i++;}
>>> i=0;while(str[i]){if(temp1[str[i]] == 1){
>>> str[i] = str[i+1];
>>> i--;}
>>> i++;}printf
>>> <http://www.opengroup.org/onlinepubs/009695399/functions/printf.html>("%s",
>>> str);}
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Kind Regards
>>> Ishan Aggarwal
>>> [image: Aricent Group]
>>> Presidency Tower-A, M.G.Road,Sector-14
>>> Gurgaon,Haryana.122015 INDIA
>>> Phone : +91-9654602663
>>> [email protected] <[email protected]>
>>>
>>> --
>>> 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.
>>
>
>
>
> --
> Kind Regards
> Ishan Aggarwal
> [image: Aricent Group]
> Presidency Tower-A, M.G.Road,Sector-14
> Gurgaon,Haryana.122015 INDIA
> Phone : +91-9654602663
> [email protected] <[email protected]>
>
> --
> 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.