描述:
给你一个由”a”,”b”,”c”三个字符组成的字符串,将其中的a替换成b,b替换成a,c保持不变
例如:
‘acb’ –> ‘bca’
‘aabacbaa’ –> ‘bbabcabb’
MyCode:
public class Kata
{
public static string Switcheroo(string x)
{
string y = x.Replace("a","d");
string z = y.Replace("b","a");
string retStr = z.Replace("d","b");
return retStr;
}
}
CodeWar:
public class Kata
{
public static string Switcheroo(string x)
{
return x.Replace("a","d").Replace("b","a").Replace("d","b");
}
}