wap in c# for the following question.

wap to identify the occurrence of 3 consecutive integer in n numbers and replace them with middle value by deleting the other two

using System;
using System.IO;
namespace abhi
{
class Program
{
public static void Main(string[] args)
{
int n;
string s;
int m=0;
Console.WriteLine(“Hello World!”);
Console.WriteLine(“Enter digits in ur number”);
n=Convert.ToInt32(Console.ReadLine());
Console.WriteLine(“Enter the number”);
s=Console.ReadLine();
int x=Convert.ToInt32(s);
int[] arr=new int[n];
int i;
int d;
for(i=0;i<n;i++)
{
d=x%10;
m=m*10+d;
x=x/10;
}

		for(i=0;i<n;i++)
		{
			arr[i]=m%10;
			m=m/10;
		}
		
		for(i=1;i<n-1;i++)
		{
			if(arr[i]==(arr[i-1]+1) && arr[i]==(arr[i+1]-1))
			{
				arr[i-1]=arr[i];
				arr[i+1]=arr[i];
			}
		}
		for(i=0;i<n;i++)
		{
			Console.Write(arr[i]);
		}
		// TODO: Implement Functionality Here
		
		Console.Write("Press any key to continue . . . ");
		Console.ReadKey(true);
	}
}

}