title: Replace Character C1 C2 C2 C1 String S
signature: class Solution {
  
      public string ReplaceCharacterC1C2C2C1StringS(string s, char c1, char c2) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(string actual, string expected){
              return new JavaScriptSerializer().Serialize(actual) == new JavaScriptSerializer().Serialize(expected);
          }
  
          public string driver(string s, char c1, char c2, string expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                string pred_result = solution_cls.PLACEHOLDER_FN_NAME(s, c1, c2); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  "IZTSMw j", 'W', 'k', 
                  "IZTSMw j"
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  "7288334", '6', '9', 
                  "7288334"
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  "010110000", '1', '1', 
                  "010110000"
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  "b gJX", 't', 'P', 
                  "b gJX"
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  "734", '4', '4', 
                  "734"
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  "1", '1', '1', 
                  "1"
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );result = runner.driver(
                  "xCaUKdhA", 'X', 'S', 
                  "xCaUKdhA"
              );
              Console.WriteLine(string.Format(
                  "TEST-6...{0}",
                  result)
              );result = runner.driver(
                  "4370992644981", '5', '6', 
                  "4370992544981"
              );
              Console.WriteLine(string.Format(
                  "TEST-7...{0}",
                  result)
              );result = runner.driver(
                  "01010", '0', '1', 
                  "10101"
              );
              Console.WriteLine(string.Format(
                  "TEST-8...{0}",
                  result)
              );result = runner.driver(
                  "ZNIFGshaWA", 'Q', 'x', 
                  "ZNIFGshaWA"
              );
              Console.WriteLine(string.Format(
                  "TEST-9...{0}",
                  result)
              );
          }
      }
  }
  
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;
  }