# QM6P5A editorial

Practice

Contest

Author: Chandan Boruah

Tester: Chandan Boruah

Editorialist: Chandan Boruah

EASY

### PREREQUISITES:

Simple Math, Brute Force.

### PROBLEM:

Given few valid sentences and few invalid, find the words that contribute to valid sentences. Valid sentences would have at least one word that is not there in invalid sentences.

### QUICK EXPLANATION:

Put all the valid words in a linked list. Enlist all invalid words in another linked list. Remove all invalid words from the valid words linked list. And print count of valid words.

### EXPLANATION:

Enlist all words in the valid words linked list. This would keep in the list all the words that can be valid. Now enlist all the words that are invalid. All words that are both in valid and invalid list would be invalid, according to problem description and examples. So print the count of words that are valid list but not in invalid list.

### AUTHORâ€™S SOLUTION IN C#:

``````using System;
using System.Collections.Generic;
class some
{
public static void Main()
{
for(int l=0;l<n;l++)
{
List<string>now=new List<string>();
List<string>no=new List<string>();
for(int i=0;i<tt;i++)
{
if(y=="yes")
{
foreach(string t in k)
{
if(!now.Contains(t))
{
}
}
}
else
{
foreach(string p in k)
{
if(!no.Contains(p))
{
}
}
}
}
int total=now.Count;
for(int i=0;i<no.Count;i++)
{
if(now.Contains(no[i]))
total--;
}
Console.WriteLine(total);
}
}
}
``````
//