当前位置:网站首页>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);
}
}边栏推荐
- [t31zl intelligent video application processor data]
- flask返回文件下载
- Binary tree creation & traversal
- A Closer Look at How Fine-tuning Changes BERT
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center
- Oracle time display adjustment
- Go learning notes (3) basic types and statements (2)
- Nft智能合约发行,盲盒,公开发售技术实战--拼图篇
- xpath中的position()函数使用
猜你喜欢

继电反馈PID控制器参数自整定

Description of octomap averagenodecolor function

解决方案:智慧工地智能巡检方案视频监控系统

Golang DNS 随便写写

Document 2 Feb 12 16:54

Epoll and IO multiplexing of redis

Key value judgment in the cycle of TS type gymnastics, as keyword use
![datax自检报错 /datax/plugin/reader/._drdsreader/plugin.json]不存在](/img/17/415e66d67afb055e94a966de25c2bc.png)
datax自检报错 /datax/plugin/reader/._drdsreader/plugin.json]不存在

The Vice Minister of the Ministry of industry and information technology of "APEC industry +" of the national economic and information technology center led a team to Sichuan to investigate the operat

Simulation of holographic interferogram and phase reconstruction of Fourier transform based on MATLAB
随机推荐
TS 体操 &(交叉运算) 和 接口的继承的区别
649. Dota2 Senate
Wireshark grabs packets to understand its word TCP segment
edge浏览器 路径获得
Flash return file download
Learn Arduino with examples
Solution: système de surveillance vidéo intelligent de patrouille sur le chantier
Launch APS system to break the problem of decoupling material procurement plan from production practice
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
解决方案:智慧工地智能巡检方案视频监控系统
Esrally domestic installation and use pit avoidance Guide - the latest in the whole network
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
A Closer Look at How Fine-tuning Changes BERT
Document 2 Feb 12 16:54
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Secure captcha (unsafe verification code) of DVWA range
Data governance: misunderstanding sorting
Understanding of law of large numbers and central limit theorem
21. Delete data
2.10transfrom attribute