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 < ishan.aggarwal.1...@gmail.com> 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 > ishan2.aggar...@aricent.com <puneet.ar...@aricent.com> > > -- > 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.