public static void replaceFun(char[] str, int length){
        int spaceCount = 0;
        for(int i = 0; i < length; i++){
            if(str[i] == ' ') spaceCount++;
        }

        int newLength = length + 2 * spaceCount;
        int end = newLength - 1;
        for(int i = length - 1; i >= 0; i--){
            if(str[i] == ' '){
                str[end--] = '0';
                str[end--] = '2';
                str[end--] = '%';
            }else{
                str[end--] = str[i];
            }
        }
    }