title: Replace Character C1 C2 C2 C1 String S
signature: class Solution {
  
      public String replaceCharacterC1C2C2C1StringS(String s, Character c1, Character c2) {
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;
  }
question_info.extension: java
question_info.entry_fn_name: replaceCharacterC1C2C2C1StringS
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": "IZTSMw j", "inputs": {"s": "IZTSMw j", "c1": "W", "c2": "k"}}, {"idx": 1, "outputs": "7288334", "inputs": {"s": "7288334", "c1": "6", "c2": "9"}}, {"idx": 2, "outputs": "010110000", "inputs": {"s": "010110000", "c1": "1", "c2": "1"}}, {"idx": 3, "outputs": "b gJX", "inputs": {"s": "b gJX", "c1": "t", "c2": "P"}}, {"idx": 4, "outputs": "734", "inputs": {"s": "734", "c1": "4", "c2": "4"}}, {"idx": 5, "outputs": "1", "inputs": {"s": "1", "c1": "1", "c2": "1"}}, {"idx": 6, "outputs": "xCaUKdhA", "inputs": {"s": "xCaUKdhA", "c1": "X", "c2": "S"}}, {"idx": 7, "outputs": "4370992544981", "inputs": {"s": "4370992644981", "c1": "5", "c2": "6"}}, {"idx": 8, "outputs": "10101", "inputs": {"s": "01010", "c1": "0", "c2": "1"}}, {"idx": 9, "outputs": "ZNIFGshaWA", "inputs": {"s": "ZNIFGshaWA", "c1": "Q", "c2": "x"}}]
question_info.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(String s, Character c1, Character c2, String expected){
          try{
              Driver driver = new Driver();
              if (driver.run(s, c1, c2,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution("IZTSMw j", 'W', 'k', "IZTSMw j");
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution("7288334", '6', '9', "7288334");
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution("010110000", '1', '1', "010110000");
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution("b gJX", 't', 'P', "b gJX");
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution("734", '4', '4', "734");
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution("1", '1', '1', "1");
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution("xCaUKdhA", 'X', 'S', "xCaUKdhA");
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution("4370992644981", '5', '6', "4370992544981");
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution("01010", '0', '1', "10101");
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution("ZNIFGshaWA", 'Q', 'x', "ZNIFGshaWA");
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(String s, Character c1, Character c2, String expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(s, c1, c2),expected);
      }
      
      public boolean validateSolution(String actual, String expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__