当前位置:网站首页>C language irony
C language irony
2022-06-30 01:31:00 【Martin の Blog】

Algorithm design ideas
- Use fget Method to get the input string
- Judge whether there is carriage return in the string , If there is a carriage return, directly set the character to the end of the positioning pointer , Output to prevent carriage return
- Determine the space in the string , If the space is not empty , Then start printing the characters after the space , And set the current pointer to the tail pointer
- Be careful strrchr The function returns the last character
- Print the remaining characters , That is, the content of the first character
Code
#include <stdio.h>
#include <string.h>
int main(){
char s[100];
char *p;
fgets(s, 100, stdin);
if((p=strrchr(s, '\n')) != NULL){
*p = '\0';
}
while((p=strrchr(s, ' ')) != NULL){
printf("%s ", p+1);
*p = '\0';
}
printf("%s", s);
return 0;
}
Running results 
边栏推荐
- Varnish foundation overview 10
- Sorting out the usage of transforms in pytoch
- [mrctf2020]ezpop-1 | PHP serialization
- Varnish foundation overview 7
- 【PyTorch实战】生成对抗网络GAN:生成动漫人物头像
- GeoTools:WKT、GeoJson、Feature、FeatureCollection相互转换常用工具
- 【机器学习Q&A】余弦相似度、余弦距离、欧式距离以及机器学习中距离的含义
- MySQL monitoring 2
- R language linear regression model fitting diagnosis outliers analysis of domestic gas consumption and calorie examples with self-test questions
- 城市规划馆在设计制作上需要注意什么
猜你喜欢

Unity2D--给动画添加关键帧并绑定事件

C语言 继续(3n+1)猜想

How to seamlessly transition from traditional microservice framework to service grid ASM

js逆向请求参数加密:

TP-LINK configure WiFi authentication method for wireless Internet SMS

What should be paid attention to in the design and production of the Urban Planning Museum

Sklearn notes: make_ Blobs generate clustering data
![【图神经网络】图分类学习研究综述[3]:图分类方法评价及未来研究方向](/img/b1/2afa73a14b2f41b7a65c4c2d261e6a.png)
【图神经网络】图分类学习研究综述[3]:图分类方法评价及未来研究方向

Kubernetes core object overview details

Machinery -- nx2007 (UG) finite element analysis tutorial 2 -- assembly
随机推荐
I, 33 years old, ByteDance test development, unveiled the real income of Beijing "test post"
win10子系统 WSL如果root和其他用户的密码都忘记的修复方法
Sentinel source code analysis Chapter 9 - core process - lookprocesschain finding resource processing chain
C语言 一元多项式求导
Design and implementation of spark offline development framework
cookie加密9
Pytorch模型训练到哪里找预训练模型?
The 8th "Internet +" competition - cloud native track invites you to challenge
C语言 写出这个数
Cookie encryption 9
【推荐系统】基于用户的协同过滤简明原理与代码实现
“乘风破浪”的芒果超媒,能上岸吗?
Three text to speech artifacts, each of which is very practical
Mysql 监控6
Resizekit2.net size and resolution independent
Understanding of int argc, char * * argv in C language main function
[MRCTF2020]Ezpop-1|php序列化
Embedded exit (review and release)
魔百盒CM201-2-CH-Hi3798MV300-300H-EMMC和NAND_红外蓝牙语音_通刷固件包
[machine learning Q & A] data sampling and model verification methods, hyperparametric optimization, over fitting and under fitting problems