Even though the output on console is correct, the system does not accept the solution. Here is the code:
/*********************************/
using System;
namespace ParametersToMethods
{
class HowManyZer0sInT0tal
{
static void Main()
{
var count = int.Parse(Console.ReadLine());
int numberOfZeros = 0;
int sumNumberOfZeros = 0;
string inputString;
int voidString = 0;
for(int i=0; i<count; i++){
inputString = Console.ReadLine();
if(!AnalyzeString(inputString, out numberOfZeros)){
voidString++;
}
if(voidString == count){
Console.WriteLine("All strings are invalid.");
}
if(AnalyzeString(inputString, out numberOfZeros)){
sumNumberOfZeros = sumNumberOfZeros + numberOfZeros;
}
}
Console.WriteLine(sumNumberOfZeros);
}
static bool AnalyzeString(string input, out int zeros){
zeros = 0;
if(String.IsNullOrEmpty(input)){
return false;
}
for(int i=0; i<input.Length; i++){
if(input[i] == '0'){
zeros++;
}
}
return true;
}
}
}
/*********************************/
I cannot find the error, do you see it anywhere?
thanks a lot