@@ -0,0 +1,850 @@
+package com.ttaylorr.ctci.answers.strings;%0A%0Aimport com.ttaylorr.ctci.meta.Solution;%0A%0A@Solution(chapter = 1, problem = 5)%0Apublic class WhitespaceReplacer %7B%0A    protected final String str;%0A%0A    public WhitespaceReplacer(String str) %7B%0A        this.str = str;%0A    %7D%0A%0A    public String asReplacedWhitespace() %7B%0A        char%5B%5D chars = this.str.toCharArray();%0A%0A        for (int i = 0; i %3C chars.length; i++) %7B%0A            if (chars%5Bi%5D == ' ') %7B%0A                char%5B%5D temp = new char%5Bchars.length+3-1%5D;%0A%0A                System.arraycopy(chars, 0, temp, 0, i - 1);%0A%0A                temp%5Bi%5D = '%25';%0A                temp%5Bi+1%5D = '2';%0A                temp%5Bi+2%5D = '0';%0A%0A                System.arraycopy(chars, i+1, temp, i+3, temp.length - 3);%0A%0A                chars = temp;%0A                i+=2;%0A            %7D%0A        %7D%0A%0A        return new String(chars);%0A    %7D%0A%7D%0A

Add WhitespaceReplacer