-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSparseArrays.cs
44 lines (40 loc) · 1.03 KB
/
SparseArrays.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Stringdemo
{
class Program
{
static void Main(string[] args)
{
int n = Convert.ToInt32(Console.ReadLine());
string[] str = new string[n];
for(int i=0;i<n;i++)
{
str[i] = Console.ReadLine();
}
int q = Convert.ToInt32(Console.ReadLine());
string[] query = new string[q];
for (int i = 0; i < q; i++)
{
query[i] = Console.ReadLine();
}
for(int i=0;i<q;i++)
{
string temp = query[i];
int count = 0;
foreach(string x in str)
{
if(temp.Contains(x))
{
count++;
}
}
Console.WriteLine(count);
}
Console.ReadLine();
}
}
}