#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
const int N = 100;

int main()
{
	char text[N], wordarray[N][N], *p,  delim[]= " ,";
	int n=0;
	printf("Enter  text: \n");
	gets(text);
	p = strtok(text, delim);
	
	while (p!= NULL)
	{
		strcpy(wordarray[n], p);
		n++;
		p = strtok(NULL, delim);
	}
	printf("Text result: \n");
	for(int i = 0; i<N; i++)
	{
		for(int j= i+1; j<N; j++)
     	{  
			if((strspn(wordarray[i], wordarray[j]) == strlen(wordarray[i])) && strlen(wordarray[i]) == strlen(wordarray[j]))
			    puts(wordarray[i]);
		}
	}
	return 0;
}