using System.Collections.Generic;
public static void Main()
Console.WriteLine(FindRotateSteps("nyngl","yyynnnnnnlllggg"));
public static int FindRotateSteps(string ring, string key) {
var keyChars = key.ToCharArray();
for(int i = 0 ;i < l; i++){
(int f, int fi) = moveForwards(c, ring, index);
(int b, int bi) = moveBackwards(c, ring, index);
Console.WriteLine($"Char {c}");
Console.Write($"Forwards: {f}, total steps: {steps} ");
Console.Write($"Backwards: {b}, total steps: {steps}");
public static (int, int) moveForwards(char c, string ring, int index){
return (steps+1, newIndex);
if(newIndex == ring.Length){
}while(newIndex != index);
public static (int, int) moveBackwards(char c, string ring, int index){
return (steps+1, newIndex);
newIndex = ring.Length-1;
}while(newIndex != index);
public static void printStr(string str, int idx){
string m = str[idx].ToString();
string e = str[(idx+1)..];
Console.Write($"\t\t{s}[{m}]{e}\n");