title: Check String Can Obtained Rotating Another String 2 Places
signature: function checkStringCanObtainedRotatingAnotherString2Places(str1: string, str2: string): boolean {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: boolean, expected: boolean): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(str1: string, str2: string, expected:boolean): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(str1, str2),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver("amazon", "azonam", true);
    console.log(`TEST-0...${result}`);
  
    result = driver("onamaz", "amazon", true);
    console.log(`TEST-1...${result}`);
  
    result = driver("amazon", "azoman", false);
    console.log(`TEST-2...${result}`);
  
    result = driver("ab", "ab", true);
    console.log(`TEST-3...${result}`);
  
    result = driver("737009", "239119", false);
    console.log(`TEST-4...${result}`);
  
    result = driver("000110", "01111", false);
    console.log(`TEST-5...${result}`);
  
    result = driver("l", "YVo hqvnGxow", false);
    console.log(`TEST-6...${result}`);
  
    result = driver("4420318628", "52856", false);
    console.log(`TEST-7...${result}`);
  
    result = driver("11011111000000", "10", false);
    console.log(`TEST-8...${result}`);
  
    result = driver(" pvFHANc", "xBIDFbiGb", false);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
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 );
  }