题解 | 排序危机 重复内容挺多

排序危机

https://www.nowcoder.com/practice/fb6a53f3ebae449cb268fd9a99cff9ef

#include <stdio.h>

int main() {
    int n,m=0;
    char s[100001],s2[100001];
    while (scanf("%d%s", &n, s) != EOF) { // 注意 while 处理多个 case
        // 64 位输出请用 printf("%lld") to 
       for(int i=0;s[i];i++){
        if(s[i]>='a'&&s[i]<='z') s2[m++]=s[i];
       }
       for(int i=0;s[i];i++){
        if(s[i]>='0'&&s[i]<='9') s2[m++]=s[i];
       }
       for(int i=0;s[i];i++)
       {if(s[i]>='A'&&s[i]<='Z') s2[m++]=s[i];}
    }
    s2[m]='\0';
    printf("%s\n",s2);
    return 0;
}

全部评论

相关推荐

牛客41406533...:回答他在课上学,一辈子待在学校的老教授用三十年前的祖传PPT一字一句的讲解,使用谭浩强红皮书作为教材在devc++里面敲出a+++++a的瞬间爆出114514个编译错误来学这样才显得专业
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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