using System.Text.RegularExpressions;
public static void Main()
Console.WriteLine($"Output: {BalancedString(s)}");
static int BalancedString(string s) {
for(int i=0; i< s.Length - 1;i++){
if (!s[i].Equals(s[i+1])) {
static void CheckBalancedString(string s){
Regex r = new Regex("^[LR]*$");
if (!r.IsMatch(s)) throw new Exception("Sentence can only be made of 'L' and 'R' characters.");
else Console.WriteLine($"{s} matches the expression.");