Dostaje na spoju kominikat "błędna odpowiedź" i mam problem ze zlokalizowaniem błędu :/
Link do zadania
A oto mój kod:
import java.io.*;
public class TOPSES
{
public static void main(String[] args) throws IOException
{
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
int counter = Integer.parseInt(read.readLine());
String a = "";
String b = "";
int i = 0;
while(counter --> 0)
{
a = read.readLine();
b = read.readLine();
for(i = 0; i < a.length(); i++)
{
if(b.charAt(i) == a.charAt(0))
break;
}
b = b.substring(i, b.length()) + b.substring(0, i);
System.out.println(a.equals(b) ? "yes" : "no");
}
}
}