You are viewing a single comment's thread. Return to all comments →
My solution in C#
public static int marsExploration(string s) { s = s.ToUpper(); int count = 0; string messageSig = "SOS"; int longitud = s.Length; var modules = new List<string>(); if((longitud < 1 || longitud > 99) && longitud % 3 != 0) throw new InvalidDataException("Longitud invalida"); for(int i = 0; i < longitud; i += 3){ modules.Add(s.Substring(i, 3)); } foreach(string subMessage in modules){ for(int j = 0; j < 3; j++){ if(subMessage[j] != messageSig[j]) count++; } } return count; }
Seems like cookies are disabled on this browser, please enable them to open this website
Mars Exploration
You are viewing a single comment's thread. Return to all comments →
My solution in C#