# DISTINCT - Editorial

Author: Deepanshu Kapoor
Tester: Chandan Boruah
Editorialist: Chandan Boruah

CAKEWALK

Brute force.

### PROBLEM:

Given a list of names, find the unique names. Print the count of unique names and print then in lexicographically ascending order.

Store the names in a linked list. If its already there in the list, then don’t add the name to the list.

# EXPLANATION:

At first, iterate over the names and add to a linked list the names. If the name is already there in the list from previous additions which can be checked by a condition, then don’t add the current name in the loop to the list. Sort the list. Print the count of names in the list and print the list in the sorted order.

### SETTER’S SOLUTION:

``````#include <bits/stdc++.h>
using namespace std;

int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
set < string > val;
for(int i=0;i<n;i++){
string s;
cin>>s;
val.insert(s);
}
cout<<val.size()<<" ";
for(set<string > ::iterator it= val.begin();it!=val.end();it++) cout<<*it<<" ";
cout<<endl;
}
return 0;
}
``````

### TESTER’S SOLUTION:

``````using System;
using System.Collections.Generic;
class some
{
public static void Main()
{
for(int test=0;test<t;test++)
{
List<string>ss=new List<string>();
for(int i=0;i<n;i++)
{