title: Check String Can Obtained Rotating Another String 2 Places
signature: bool checkStringCanObtainedRotatingAnotherString2Places(string str1, string str2) {
test_code: #include <algorithm>
  #include <assert.h>
  #include <cstdlib>
  #include <iostream>
  #include <map>
  #include <set>
  #include <string>
  #include <tuple> 
  #include <unordered_map>
  #include <vector>
  #include <math.h>
  #include <cmath>
  #include <bits/stdc++.h>
  #include <numeric>
  #include <functional>
  
  using namespace std;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(bool actual, bool expected){
      return actual == expected;
  }
  
  string driver(string str1, string str2, bool expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(str1, str2), expected)){
              return "PASSED";
          }
          return "FAILED";
      }
      catch (const std::overflow_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::runtime_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::exception& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (...)
      {
          return "UNK_ERROR";
      }
  }
  
  int main() {
      string result = "";
  
      result = driver("amazon", "azonam", true); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver("onamaz", "amazon", true); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver("amazon", "azoman", false); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver("ab", "ab", true); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver("737009", "239119", false); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver("000110", "01111", false); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver("l", "YVo hqvnGxow", false); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver("4420318628", "52856", false); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver("11011111000000", "10", false); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver(" pvFHANc", "xBIDFbiGb", false); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
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 );
  }