CrazyEngineers
  • Help with code

    raj.kmolkar

    Member

    Updated: Oct 25, 2024
    Views: 1.0K
    [FONT=&quot] [/FONT][FONT=&quot]Given a string and a number ‘n’, find the ‘n’th distinct repeating character. [/FONT]

    [FONT=&quot]For example, [/FONT]
    [FONT=&quot]Input:[/FONT]
    [FONT=&quot]Abracadabra, 1[/FONT]
    [FONT=&quot]Abracadabra, 2[/FONT]
    [FONT=&quot]Abracadabra, 3[/FONT]
    [FONT=&quot]Abracadabra, 4[/FONT]
    [FONT=&quot] [/FONT]
    [FONT=&quot]Output[/FONT]
    [FONT=&quot]a[/FONT]
    [FONT=&quot]b[/FONT]
    [FONT=&quot]r[/FONT]
    [FONT=&quot]null[/FONT]
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Bharath51

    MemberAug 21, 2011

    #include<stdio.h>
    #include<conio.h>
    #include<string.h>
    void main()
    {
    char arr[10],c;
    int n,i,count=0;
    clrscr();
    printf("Enter the string:");
    gets(arr);
    printf("enter the position\n");
    scanf("%d",&n);
    c=arr[n];
    i=n-1;
    for(i;i>=0;i--)
    if(arr==c)
    count++;


    if(count>=1 )
    printf("\nnull");
    else
    printf("\n%d",n);


    getch();
    }
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register