{
                  
                  
                              if (string.IsNullOrEmpty(str1) || string.IsNullOrEmpty(str2)) throw new Exception("Nullable value`s");
                  
                  
                              List<Range>[] ret = {new List<Range>(),new List<Range>()};
                  
                  
                              if (str1.Length > str2.Length) str1 = str1.Substring(0, str2.Length);
                  
                  
                              if (str2.Length > str1.Length) str2 = str1.Substring(0, str1.Length);
                  
                  
                              var tmp = str1.Select((t, i) => t == str2[i]).ToList();
                  
                  
                              for (int i = 0, x=0, len=1; i < tmp.Count-1; i++,len++)
                  
                  
                                  if(tmp[i]!=tmp[i+1])
                  
                  
                                  {
                  
                  
                                      ret[tmp[i]?0:1].Add(new Range{X=x,Lenth = len});
                  
                  
                                      x = i + 1;
                  
                  
                                      len = 0;
                  
                  
                                  }
                  
                  
                              return ret;
                  
                  
                          }
                  
                  
                
не проверял, могуть быть неточности
по итогу - написал еще больший говнокод, использовал linq, плюс оно еще и неправильно работает
Обсуждают сегодня