-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8-1.linq
34 lines (33 loc) · 893 Bytes
/
8-1.linq
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
<Query Kind="Program" />
void Main()
{
Directory.SetCurrentDirectory (Path.GetDirectoryName (Util.CurrentQueryPath));
var inputLines = File.ReadAllText("8.txt").Split(new[] { Environment.NewLine }, StringSplitOptions.None);
int higherTotal = 0;
int lowerTotal = 0;
foreach (var input in inputLines)
{
higherTotal += input.Length;
int count = 0;
for (int i = 0; i < input.Length; i++)
{
if (input[i] == '"') continue;
if (input[i] == '\\')
{
count++;
if (input[i+1] == 'x')
{
i += 3;
}
else
{
i += 1;
}
continue;
}
count++;
}
lowerTotal += count;
}
(higherTotal - lowerTotal).Dump();
}