|
|
вернуться в форумWhat's wrong with my C# code? It is giving wrong answer in case # 2...
long stringLength = Convert.ToInt32(Console.ReadLine()); string S = Console.ReadLine(); string T = Console.ReadLine(); long temp = 0; bool check = false; for (long i = 0; i < stringLength; i++) { S = S[Convert.ToInt32(stringLength) - 1] + S.Substring(0, Convert.ToInt32(stringLength) - 1); if (S == T) { temp = i + 1; check = true; break; } } if (check && temp < stringLength) Console.WriteLine(temp); else Console.WriteLine(-1);
|
|
|