当前位置:网站首页>1202 character lookup
1202 character lookup
2022-07-06 07:58:00 【Zhanglilong 666】
Title Description
Find a specified character in a string , And output the number and position of the specified character in the string .
Input requirements
On the first line, enter a string , On the second line, enter the character you want to find .
Output requirements
The first line outputs the number of times the character has appeared in the string n, Back n Line outputs the place where the character once appeared ( The position of occurrence is calculated according to the daily habit from 1 Start marker )
sample input
maybeyesmaybleno m
sample output
2 1 9
#include<cstdio>
#include<cstring>
int main()
{
char a[1006],k;
int zll[1006]={0},len,i,sum=0,j=0;
gets(a);
len=strlen(a);
scanf("%c",&k);
for(i=0;i<len;i++){
if(a[i]==k){
sum++;
zll[j]=i;
j++;
}
}
printf("%d\n",sum);
for(i=0;i<j;i++){
printf("%d\n",zll[i]+1);
}
}边栏推荐
- Data governance: Data Governance under microservice architecture
- "Friendship and righteousness" of the center for national economy and information technology: China's friendship wine - the "unparalleled loyalty and righteousness" of the solidarity group released th
- TS 体操 &(交叉运算) 和 接口的继承的区别
- [nonlinear control theory]9_ A series of lectures on nonlinear control theory
- [untitled]
- Luogu p4127 [ahoi2009] similar distribution problem solution
- MFC 给列表控件发送左键单击、双击、以及右键单击消息
- 解决方案:智慧工地智能巡检方案视频监控系统
- 洛谷P1836 数页码 题解
- Interview Reply of Zhuhai Jinshan
猜你喜欢

Google may return to the Chinese market after the Spring Festival.

Nft智能合约发行,盲盒,公开发售技术实战--合约篇

Pre knowledge reserve of TS type gymnastics to become an excellent TS gymnastics master

Database basic commands

Codeforces Global Round 19(A~D)
![[t31zl intelligent video application processor data]](/img/67/b77c1de990d9b8868f8df5e55b0227.png)
[t31zl intelligent video application processor data]

Inspiration from the recruitment of bioinformatics analysts in the Department of laboratory medicine, Zhujiang Hospital, Southern Medical University

22. Empty the table

Understanding of law of large numbers and central limit theorem

Epoll and IO multiplexing of redis
随机推荐
esRally国内安装使用避坑指南-全网最新
Pangolin Library: control panel, control components, shortcut key settings
Asia Pacific Financial Media | "APEC industry +" Western Silicon Valley invests 2trillion yuan in Chengdu Chongqing economic circle to catch up with Shanghai | stable strategy industry fund observatio
TS 类型体操 之 extends,Equal,Alike 使用场景和实现对比
Data governance: 3 characteristics, 4 transcendence and 3 28 principles of master data
datax自检报错 /datax/plugin/reader/._drdsreader/plugin.json]不存在
2.10transfrom attribute
MES, APS and ERP are essential to realize fine production
MEX有关的学习
onie支持pice硬盘
Learn Arduino with examples
Basics of reptile - Scratch reptile
C intercept string
Compliance and efficiency, accelerate the digital transformation of pharmaceutical enterprises, and create a new document resource center for pharmaceutical enterprises
Machine learning - decision tree
The State Economic Information Center "APEC industry +" Western Silicon Valley will invest 2trillion yuan in Chengdu Chongqing economic circle, which will surpass the observation of Shanghai | stable
edge浏览器 路径获得
flask返回文件下载
Oracle time display adjustment
【T31ZL智能视频应用处理器资料】