int main()
{
char *str = "see you later";
int r = strlen(str);
char * p = str;
int a= ;
while(*str++!='\0')
{
if(*str == ' ')
{
a++;
}
}
str-=(r+);
int arr[a];
int i,j;
for(i =,j=;i<r;i++)
{
if(*str ==' ')
{
arr[j] = i;
j++;
}
str++;
}
str-=(r-);
//puts(p+arr[1]);
char arr2[r+];
int k = ;
puts(p);
while(*str!='\0')
{
if(*str == ' ')
{
arr2[k] = '\0';
}
else
{
arr2[k] = *str;
}
str++;
k++;
}
arr2[k] = '\0';
p = arr2;
for(i = a-;i>=;i--)
{
puts(p+arr[i]);
}
puts(p); return ;
}

C语言 反序打印字符串中的单词的更多相关文章

  1. [LeetCode] Reverse Words in a String 翻转字符串中的单词

    Given an input string, reverse the string word by word. For example, Given s = "the sky is blue ...

  2. [Swift]LeetCode434. 字符串中的单词数 | Number of Segments in a String

    Count the number of segments in a string, where a segment is defined to be a contiguous sequence of ...

  3. Leetcode#557. Reverse Words in a String III(反转字符串中的单词 III)

    题目描述 给定一个字符串,你需要反转字符串中每个单词的字符顺序,同时仍保留空格和单词的初始顺序. 示例 1: 输入: "Let's take LeetCode contest" 输 ...

  4. 力扣(LeetCode)字符串中的单词数 个人题解

    统计字符串中的单词个数,这里的单词指的是连续的不是空格的字符. 请注意,你可以假定字符串里不包括任何不可打印的字符. 示例: 输入: "Hello, my name is John" ...

  5. [LeetCode] 151. Reverse Words in a String 翻转字符串中的单词

    Given an input string, reverse the string word by word. For example,Given s = "the sky is blue& ...

  6. leetcode434 字符串中的单词树(python)

    统计字符串中的单词个数,这里的单词指的是连续的不是空格的字符. 请注意,你可以假定字符串里不包括任何不可打印的字符. 示例: 输入: "Hello, my name is John" ...

  7. [LeetCode] Reverse Words in a String II 翻转字符串中的单词之二

    Given an input string, reverse the string word by word. A word is defined as a sequence of non-space ...

  8. [Swift]LeetCode557. 反转字符串中的单词 III | Reverse Words in a String III

    Given a string, you need to reverse the order of characters in each word within a sentence while sti ...

  9. C#版(击败97.76%的提交) - Leetcode 557. 反转字符串中的单词 III - 题解

    版权声明: 本文为博主Bravo Yeung(知乎UserName同名)的原创文章,欲转载请先私信获博主允许,转载时请附上网址 http://blog.csdn.net/lzuacm. Leetcod ...

随机推荐

  1. HDOJ(HDU).1035 Robot Motion (DFS)

    HDOJ(HDU).1035 Robot Motion [从零开始DFS(4)] 点我挑战题目 从零开始DFS HDOJ.1342 Lotto [从零开始DFS(0)] - DFS思想与框架/双重DF ...

  2. Dynamic Rankings——带修改区间第k大

    三种做法:1.整体二分: 二分mid 考虑小于mid的修改的影响 但是大于mid的修改可能会干掉小于mid的一些值 所以额外把一个修改变成一个值的删除和一个值的添加 这样就相互独立了! 整体二分,树状 ...

  3. 题解【luoguP4145 上帝造题的七分钟2(花神游历各国)】

    题目链接 题解 题目大意: 一个序列,支持区间开方与求和操作. 算法:线段树实现开方修改与区间求和 分析: 显然,这道题的求和操作可以用线段树来维护 但是如何来实现区间开方呢 大家有没有这样的经历:玩 ...

  4. DOM基本代码二

    ------------------------------- <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xh ...

  5. Jenkins自动化构建系列:01敏捷开发、自动化构建与持续集成

    <SVN与TortoiseSVN实战系列>已写完,今天新开一个<Jenkins自动化构建系列>,上周听了Bob Jiang老师的Agile1001公开课,一直想写个总结,这篇关 ...

  6. 获取Web.Config中节点的值

    读取webconfig里面的appSetting和connectionString <appSettings> <add key="SiteURL" value= ...

  7. Azure Pipelines

    https://docs.microsoft.com/en-us/azure/devops/pipelines/?view=vsts

  8. Shell脚本循环读取文件中的每一行

    1.使用for循环 for line in `cat filename` do echo $line done 2.使用for循环 for line in $(cat filename) do ech ...

  9. [技巧篇]21.Android Studio的快捷键设置[图片版]

    如果对你有帮助,请点击推荐!

  10. Test Index

    top1 top11 top2 top1 top11 top2