char* newstr(char * str){
    if(str == NULL)
        return NULL;
    int blank = ;
    int len = strlen(str);
    int i = ;
    for(i = ; i < len ; i++)
        if(str[i] == ' ')
            blank++;
    int j = ;
    char * newhead = new char[len + blank* +];
    for(i = ; i < len; i++){
        if(str[i] != ' ')
            newhead[j++] = str[i];
        else{
            newhead[j++] = '%';
            newhead[j++] = '';
            newhead[j++] = '';
        }
    }
    newhead[j] = '\0';
    str = newhead; 
    return str;
}

ctci1.4的更多相关文章

  1. ctci1.8

    bool isSub(string str0, string str1){     if(str0.length() != str1.length())         return false;   ...

  2. ctci1.3

    ; i < len; i++){         if(str0[i] != str1[i])             return false;     }          return t ...

  3. ctci1.2

    ;     ; i < len/; i++){         tmp = *(str+i);         *(str+i) = *(str+len--i);         *(str+l ...

  4. ctci1.1

    )         ;     ; i < len; i++){         if(place.find(str[i]) == place.end())             place. ...

随机推荐

  1. 脱离JVM? Hadoop生态圈的挣扎与演化

    本文由知乎<大数据应用与实践>专栏 李呈祥授权发布,版权所有归作者,转载请联系作者! 新世纪以来,互联网及个人终端的普及,传统行业的信息化及物联网的发展等产业变化产生了大量的数据,远远超出 ...

  2. jQuery Ajax使用总结

    一.概述 jQuery对Ajax操作进行了封装,在jQuery中$.ajax()是属于最底层的方法,第2层是load().$.get()和$.post()方法,第三层是$.getScript()和$. ...

  3. javascript面向对象笔记(一)

    ECMAscript对象(以下简称对象): ECMA-262把对象定义为:无序属性的集合,其属性可以包含基本值.对象或者函数. 对象的每个属性或方法都有一个名字,而每个名字都映射到一个值.值可以是数据 ...

  4. PKU 2823 Sliding Window(线段树||RMQ||单调队列)

    题目大意:原题链接(定长区间求最值) 给定长为n的数组,求出每k个数之间的最小/大值. 解法一:线段树 segtree节点存储区间的最小/大值 Query_min(int p,int l,int r, ...

  5. 2016-2017 National Taiwan University World Final Team Selection Contest A - Hacker Cups and Balls

    题目: Dreamoon likes algorithm competitions very much. But when he feels crazy because he cannot figur ...

  6. hdu3374 String Problem

    地址:http://acm.hdu.edu.cn/showproblem.php?pid=3374 题目: String Problem Time Limit: 2000/1000 MS (Java/ ...

  7. Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) B. The Meeting Place Cannot Be Changed

    地址:http://codeforces.com/contest/782/problem/B 题目: B. The Meeting Place Cannot Be Changed time limit ...

  8. weblogic控制台部署web项目图解

    图解网址:http://jingyan.baidu.com/article/c74d6000650d470f6b595d72.html

  9. Jquery编历数组

    <html> <head> <title>编历</title> <script type="text/javascript"& ...

  10. JavaScript校验网址

    JavaScript校验网址 var linkUrl = 'https://www.baidu.com' if( typeof (linkUrl) != undefined && li ...