📜  https:www.geeksforgeeks.org a-program-to-check-if-strings-are-rotations-of-each-other - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:03.390000             🧑  作者: Mango

代码示例2
1. Create a temp string and store concatenation of str1 to
       str1 in temp.
                          temp = str1.str1
    2. If str2 is a substring of temp then str1 and str2 are 
       rotations of each other.

    Example:                 
                     str1 = "ABACD"
                     str2 = "CDABA"

     temp = str1.str1 = "ABACDABACD"
     Since str2 is a substring of temp, str1 and str2 are 
     rotations of each other.