题解 | #单词倒排#

单词倒排

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

/****
*注意正则表达式的使用和含义
*****/
#include <stdio.h>
#include <string.h>

int main() {
    char str[500][21] = {0};
    int i = 0;
    int x;
    while(1){
        x = scanf( "%[a-z|A-Z]",str[i] );//正则表达式,只读取字母,其余保存
        if( getchar() == '\n' )
            break;
        if(x)
            i++;
    }
    for( int j = i; j>=0; j-- )
    {
        printf("%s ", str[j]);
    }

    return 0;
}

全部评论

相关推荐

点赞 评论 收藏
分享
05-30 12:03
山西大学 C++
offer来了我跪着...:不是骗子,等到测评那一步就知道为啥这么高工资了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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