From ceef7b3c95cab6ea71eb6602a164a0abc8fb0349 Mon Sep 17 00:00:00 2001 From: pikoslav Date: Thu, 18 Apr 2024 11:34:45 +0200 Subject: [PATCH] Create procedural.cs (#62) --- src/cs/piki/procedural.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/cs/piki/procedural.cs diff --git a/src/cs/piki/procedural.cs b/src/cs/piki/procedural.cs new file mode 100644 index 0000000..d75c472 --- /dev/null +++ b/src/cs/piki/procedural.cs @@ -0,0 +1,23 @@ +using System; +using System.Text; + + +var s = "AAABBAACC"; +var r = new StringBuilder(); +var c = 1; +var i = 0; +do +{ + if (s[i] == s[i + 1]) + { + c++; + } + else + { + r.Append("" + c + s[i]); + c = 1; + } +} +while (++i < s.Length - 1); + +Console.WriteLine(r.ToString());