Console.WriteLine("請輸入一串英文字母:");
string a = Console.ReadLine();
byte[] x = Encoding.ASCII.GetBytes(a);
int[] temp = new int[x.Length];
for (int i = x.Length-1; i >= 0; i--)
{
if (i - 1 > 0)
{
int v = Convert.ToInt32(x[i]) >> 4;
temp[i] = v + Convert.ToInt32(x[i-1]);
}
if (i - 1 == 0)
{
temp[i] = Convert.ToInt32(x[i]) + Convert.ToInt32(x[x.Length-1]);
}
if (i == 0)
{
temp[i]= Convert.ToInt32(x[i]) + Convert.ToInt32(x[i]);
}
}
string b = null;
byte[] y = new byte[temp.Length];
for (int i = 0; i < temp.Length-1; i++)
{
y[i] = Convert.ToByte(temp[i]);
b = Encoding.ASCII.GetString(y);
}
if (temp.Length == 1)
{
y[0] = Convert.ToByte(temp[0]);
b = Encoding.ASCII.GetString(y);
}
string[] overNum = new string[] { a, b };
foreach (var item in overNum)
{
Console.WriteLine(item);
}