题解 | #单词倒排#

单词倒排

https://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
    char* str = (char*)malloc(sizeof(char)*1000);
    gets(str);
    int n = strlen(str);
    char *p = &str[n-1];
    int i = 0;
    for(i = n-1;i>=0;i--)
    {
        p--;
        if(*p<'A' || *p >'z' || *p>'Z'&& *p<'a')
        {
            printf("%s ",(p+1));
            *p = '\0';
        }
        
    }
    
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务