using System;
public class Program
{
public static void Main()
char[] input = "is this okay for you? ".ToCharArray();
Console.WriteLine(ReplaceString(input, 20));
}
// Given a string with enough spaces at the end and last index of input
// replace all spaces with "%20"
public static string ReplaceString(char[] str, int last)
int end = str.Length-1;
while (last >=0 )
if (str[last] == ' ')
str[end--] = '0';
str[end--] = '2';
str[end--] = '%';
else
str[end--] = str[last];
last--;
return new string(str);