Implement a program to check if two strings are rotations of each other.
MediumProblem Statement
Implement a program to check if two strings are rotations of each other.
Sample Input
std::string str1 = "abcd", str2 = "cdab";
Sample Output
Strings are rotations of each other.
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
#include <iostream>
#include <string>
int main() {
std::string str1 = "abcd", str2 = "cdab";
// Logic to check for rotations
return 0;
}
Input
std::string str1 = "abcd", str2 = "cdab";
Expected Output
Strings are rotations of each other.