title: Replace Character C1 C2 C2 C1 String S
signature: function replaceCharacterC1C2C2C1StringS(s, c1, c2) {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value) {
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual, expected){
      return convertToString(actual)===convertToString(expected);
  }
  
  function driver(s, c1, c2, expected){
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(s, c1, c2),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver("IZTSMw j", 'W', 'k', "IZTSMw j");
    console.log(`TEST-0...${result}`);
  
    result = driver("7288334", '6', '9', "7288334");
    console.log(`TEST-1...${result}`);
  
    result = driver("010110000", '1', '1', "010110000");
    console.log(`TEST-2...${result}`);
  
    result = driver("b gJX", 't', 'P', "b gJX");
    console.log(`TEST-3...${result}`);
  
    result = driver("734", '4', '4', "734");
    console.log(`TEST-4...${result}`);
  
    result = driver("1", '1', '1', "1");
    console.log(`TEST-5...${result}`);
  
    result = driver("xCaUKdhA", 'X', 'S', "xCaUKdhA");
    console.log(`TEST-6...${result}`);
  
    result = driver("4370992644981", '5', '6', "4370992544981");
    console.log(`TEST-7...${result}`);
  
    result = driver("01010", '0', '1', "10101");
    console.log(`TEST-8...${result}`);
  
    result = driver("ZNIFGshaWA", 'Q', 'x', "ZNIFGshaWA");
    console.log(`TEST-9...${result}`);
  
    process.exit(0);
  };
  
  if (require.main === module) {
    main();
  }
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;
  }