title: Replace Character C1 C2 C2 C1 String S
signature: string replaceCharacterC1C2C2C1StringS(string s, char c1, char c2) {
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(string actual, string expected){
      return actual == expected;
  }
  
  string driver(string s, char c1, char c2, string expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(s, c1, c2), 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("IZTSMw j", 'W', 'k', "IZTSMw j"); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver("7288334", '6', '9', "7288334"); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver("010110000", '1', '1', "010110000"); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver("b gJX", 't', 'P', "b gJX"); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver("734", '4', '4', "734"); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver("1", '1', '1', "1"); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver("xCaUKdhA", 'X', 'S', "xCaUKdhA"); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver("4370992644981", '5', '6', "4370992544981"); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver("01010", '0', '1', "10101"); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver("ZNIFGshaWA", 'Q', 'x', "ZNIFGshaWA"); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
source_py: def replace_character_c1_c2_c2_c1_string_s(s, c1, c2):
      l = len(s)
      for i in range(l):
          if (s[i] == c1):
              s = ((s[0:i] + c2) + s[(i + 1):])
          elif (s[i] == c2):
              s = ((s[0:i] + c1) + s[(i + 1):])
      return s
source_cpp: string replace_character_c1_c2_c2_c1_string_s(string s, char c1, char c2) {
    int l = s . length ( );
    for ( int i = 0;
    i < l;
    i ++ ) {
      if ( s [ i ] == c1 ) s [ i ] = c2;
      else if ( s [ i ] == c2 ) s [ i ] = c1;
    }
    return s;
  }