C# loop method. Need help

I just got off an intervew and i think I totally bombed it and need help figuring out how to get this to work. Any help would be appreciated.

input should be a string and an integer J.

function needs to print out the characters but if a charcter is the same as in of the last J. put a X space inbetween.

Example 1: input Dosomething("AA",2)

output Should be AXXA

needs to have 2 characters printed before it prints the the same one.

Example 2 input DoSomething("ABB",2)

output should be ABXXB

Example 3: DoSomething("ABABA",3)

output should be ABXXABXXA

befor printing the same charcter. the last 3 need to be something else

the 3 characters that are between A are BXX.

by J2ain via /r/csharp

Leave a Reply