<코드>

#include <stdio.h>
#include <string.h>

int main()
{
	char str[10][100];
	char tmp[100];
	char c;
	
	for(int i=0; i<10; i++)
		fscanf(stdin, " %s", str[i]);
	fscanf(stdin, " %c", &c);
	
	for(int i=9; i>=0; i--)
	{
		for(int j=0; j<i; j++)
		{
			if(strcmp(str[i], str[j])<0)
			{
				strcpy(tmp, str[i]);
				strcpy(str[i], str[j]);
				strcpy(str[j], tmp);
			}
		}
	}
	
	for(int i=0; i<10; i++)
	{
		if(strchr(str[i], c))
			fprintf(stdout, "%s\n", str[i]);
	}
	
	return 0;
}

+ Recent posts