-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBA_A
43 lines (33 loc) · 977 Bytes
/
BA_A
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
using System;
namespace z1
{
class Program
{
static int PatternCount(string text,string pattern)
{
int cnt = 0;
for(int i=0;i<text.Length;i++)
{
int j = 0;
if(pattern[0]==text[i])
{
int k = i;
while ( pattern[j]==text[k])
{
j++;
k++;
if (j == pattern.Length || k == text.Length) break;
}
if (j == pattern.Length) cnt++;
}
}
return cnt;
}
static void Main(string[] args)
{
//int rez = PatternCount("ACTGCCTA", "CT");
int rez = PatternCount("ACTATATGCCTAT", "TAT");
Console.WriteLine("rez : {0}",rez);
}
}
}