private static int GetIndentation(string s)
{
int i = 0;
while (i < s.Length && char.IsWhiteSpace(s[i]))
i++;
//for lines entirely consisting of whitespace return int.MaxValue
//so it won't affect indentation calculation
return i == s.Length ? int.MaxValue : i;
}