top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Write a C program to delete all repeated words in string?

+2 votes
1,384 views

If i am giving input-- welcome to c programming language, c programming language by E. Balagurusamy !
The output will be-- welcome to c programming language, by E. Balagurusamy !

posted May 14, 2017 by Neeraj Kumar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

http://fukatsoft.com/b/bci-applications/

Brain-computer interface (BCI) is a collaboration between a brain and a
device that enables signals from the brain to direct some external activity,
such as control of a cursor or a prosthetic limb.

khadimg5544@gmail.com

answer Nov 27, 2019 by Khadim G
–1 vote
   #include <stdio.h>  
   #include <string.h> 
   void main()
{
        char a[100], b[20][20];
        int i, j = 0, k = 0, n, m;
        printf("enter the string\n");
        scanf("%[^\n]s", a);
        for (i = 0;a[i] != '\0';i++)
        {
            if (a[i] == ' ')
            {
                b[k][j] = '\0';
                k++;
                j = 0;
            }
            else
            {
                b[k][j] = a[i];
                j++;
            }
        }
        b[k][j] = '\0';
        for (i = 0;i <= k;i++)
        {
            for (j = i + 1;j <= k;j++)
            {
                if (strcmp(b[i], b[j]) == 0)
                {
                    for (m = j;m <= k;m++)
                          {
                        strcpy(b[m], b[m + 1]);
                        k--;
                          }
                }
            }
        }
        for (n = 0;n <= k;n++)
        {
            printf("%s\n", b[n]);
        } 
}
answer May 15, 2017 by Pankaj Singh
Similar Questions
–1 vote

Write a C program to check if the given string is repeated substring or not.
ex
1: abcabcabc - yes (as abc is repeated.)
2: abcdabababababab - no

+2 votes

Output
Enter the string: Welcome to C Class!
Enter the word to insert: programming
Enter the position you like to insert: 3
The string after modification is

Welcome to C programming Class!

0 votes

Enter character: r
Enter string: programming
Output: Positions of 'r' in programming are: 2 5
Character 'r' occurred for 2 times

+2 votes

Write a C program which accept two strings and print characters in second string which are not present in first string?

Example:
String 1: apple
String 2: aeroplane

output:
ron

...