private string Apply(RotateByLetter op, string input) { int index = input.IndexOf(op.Letter); int chop = input.Length - (index + 1 + (index >= 4 ? 1 : 0)) % input.Length; return(input.Substring(chop) + input.Substring(0, chop)); }
private string Apply(RotateByLetter op, string input) { Debug.Assert(input.Length == InputLength); int index = input.IndexOf(op.Letter); int chop = Unrotate[index]; //int original = index == 0 ? 7 : (index%2 == 0 ? (index + InputLength)/2 - 1 : (index - 1)/2); return(input.Substring(chop) + input.Substring(0, chop)); }