title: Check String Can Obtained Rotating Another String 2 Places
signature: class Solution {
  
      public Boolean checkStringCanObtainedRotatingAnotherString2Places(String str1, String str2) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(String str1, String str2, Boolean expected){
          try{
              Driver driver = new Driver();
              if (driver.run(str1, str2,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution("amazon", "azonam", true);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution("onamaz", "amazon", true);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution("amazon", "azoman", false);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution("ab", "ab", true);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution("737009", "239119", false);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution("000110", "01111", false);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution("l", "YVo hqvnGxow", false);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution("4420318628", "52856", false);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution("11011111000000", "10", false);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(" pvFHANc", "xBIDFbiGb", false);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(String str1, String str2, Boolean expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(str1, str2),expected);
      }
      
      public boolean validateSolution(Boolean actual, Boolean expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def check_string_can_obtained_rotating_another_string_2_places(str1, str2):
      if (len(str1) != len(str2)):
          return False
      clock_rot = ''
      anticlock_rot = ''
      l = len(str2)
      anticlock_rot = ((anticlock_rot + str2[(l - 2):]) + str2[0:(l - 2)])
      clock_rot = ((clock_rot + str2[2:]) + str2[0:2])
      return ((str1 == clock_rot) or (str1 == anticlock_rot))
source_cpp: bool check_string_can_obtained_rotating_another_string_2_places(string str1, string str2) {
    if ( str1 . length ( ) != str2 . length ( ) ) return false;
    string clock_rot = "";
    string anticlock_rot = "";
    int len = str2 . length ( );
    anticlock_rot = anticlock_rot + str2 . substr ( len - 2, 2 ) + str2 . substr ( 0, len - 2 );
    clock_rot = clock_rot + str2 . substr ( 2 ) + str2 . substr ( 0, 2 );
    return ( str1 . compare ( clock_rot ) == 0 || str1 . compare ( anticlock_rot ) == 0 );
  }