//2 static void Main(string[] args) { Console.WriteLine("Введите значение:"); string originalString = Console.ReadLine(); string packedString = PackString(originalString); Console.WriteLine("Packed String: " + packedString); } static string PackString(string originalString) { if (string.IsNullOrEmpty(originalString)) { return ""; } string packed = ""; int count = 1; for (int i = 0; i < originalString.Length; i++) { if (i == originalString.Length - 1 || originalString[i] != originalString[i + 1]) { packed += count.ToString() + originalString[i]; count = 1; } else { count++; } } return packed; }