using
System;
using
System.Collections.Generic;
class
GFG{
static
void
string_modify(
char
[] s)
{
char
[]alphabets =
new
char
[26];
int
flag = 0, hold_i = 0;
char
hold_l = (
char
)0;
int
i;
for
(i = 0; i < 26; i++)
{
alphabets[i] = (
char
)(i +
'a'
);
}
HashSet<
int
>difference =
new
HashSet<
int
>();
String reconstruct =
""
;
for
(i = 1; i < s.Length; i++)
{
difference.Add(s[i] - s[i - 1]);
}
if
(difference.Count == 1)
{
Console.Write(
"No modifications required"
);
return
;
}
foreach
(
int
it
in
difference)
{
int
index = s[0] -
'a'
;
reconstruct =
""
;
flag = 0;
for
(i = 0; i < s.Length && flag <= 1; i++)
{
reconstruct += alphabets[index];
index += it;
if
(index < 0)
{
index += 26;
}
index %= 26;
if
(reconstruct[i] != s[i])
{
flag++;
hold_i = i;
hold_l = s[i];
}
}
if
(flag == 1)
{
s[hold_i] = reconstruct[hold_i];
break
;
}
}
if
(flag < 1)
{
hold_i = 0;
hold_l = s[0];
int
temp = (s[1] -
'a'
- (s[2] - s[1])) % 26;
if
(temp < 0)
{
temp += 26;
}
s[0] = alphabets[temp];
}
Console.Write(hold_i +
" -> "
+
hold_l +
"\n"
+
String.Join(
""
, s) +
"\n"
);
}
public
static
void
Main(String[] args)
{
String s =
"aeimqux"
;
string_modify(s.ToCharArray());
}
}