Untitled
Never
import java.util.Scanner; public class Main { public static boolean isRotation(String str1, String str2) { if (str1.length() != str2.length() || str1.isEmpty()) { return false; } String concatenated = str1 + str1; return concatenated.contains(str2); } public static int findRotationLevel(String str1, String str2) { if (!isRotation(str1, str2)) { return -1; } for (int i = 1; i <= str1.length(); i++) { if (isRotation(str1.substring(i) + str1.substring(0, i), str2)) { return i+1; } } return -1; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] str = sc.nextLine().split(" "); int rotationLevel = findRotationLevel(str[0], str[1]); System.out.println(rotationLevel); } }
Raw Text
-
Adult Telegram Channels
32 min ago
-
The Success Vitamin - Your Sales Trainer in India
54 min ago
-
♥️♥️PEDOMON//PEDOSISTER♥️♥️
1 hour ago
-
Smart Hemp Cbd Gummies Australia (Best Pain Relief 2024 Scam)
1 hour ago
-
Pedowoman boy
1 hour ago
-
Russian tEE333ns
1 hour ago
-
P4CK M3G4 FIL3S T.I.E.R
1 hour ago
-
720GB CeePee
1 hour ago
-
( C H I L D P O R N )
1 hour ago
-
Candy Girls 🧬🧬🧬🧬
1 hour ago