题解 | #简写单词#

简写单词

https://www.nowcoder.com/practice/0cfa856bf0d649b88f6260d878f35bb4

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
    char *p=NULL;
    p=(char *)malloc(sizeof(char)*5000);
    gets(p);
    int i=0;
    char *str=NULL;
    str=(char *)malloc(sizeof(char)*100);
    for(i=0;i<strlen(p);i++)
    {
        if(p[i]>='a'&&p[i]<='z')
        {
            p[i]=p[i]-32;       //全部转换为大写;
        }
    }
  //判断是否需要输出
    for(i=0;i<strlen(p);i++)
    {
        if(i==0||p[i-1]==' ')
        {
            printf("%c",p[i]);
        }
    }
    return 0;
}

全部评论

相关推荐

迷茫的大四🐶:价格这么低都能满了?
点赞 评论 收藏
分享
看起来名字可以很长:笑死 我暑期实习阿里云的意向也被 qq 邮箱放在垃圾箱了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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