当前位置:网站首页>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);
}
}边栏推荐
- [computer skills]
- CAD ARX 获取当前的视口设置
- (lightoj - 1410) consistent verbs (thinking)
- [count] [combined number] value series
- A Closer Look at How Fine-tuning Changes BERT
- Launch APS system to break the problem of decoupling material procurement plan from production practice
- 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
- Uibehavior, a comprehensive exploration of ugui source code
- Hackathon ifm
- Rust language - receive command line parameter instances
猜你喜欢

. Net 6 learning notes: what is NET Core

Opencv learning notes 8 -- answer sheet recognition

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

National economic information center "APEC industry +": economic data released at the night of the Spring Festival | observation of stable strategy industry fund
![DataX self check error /datax/plugin/reader/_ drdsreader/plugin. Json] does not exist](/img/17/415e66d67afb055e94a966de25c2bc.png)
DataX self check error /datax/plugin/reader/_ drdsreader/plugin. Json] does not exist

Data governance: 3 characteristics, 4 transcendence and 3 28 principles of master data

Linked list interview questions (Graphic explanation)
![[非线性控制理论]9_非线性控制理论串讲](/img/a8/03ed363659a0a067c2f1934457c106.png)
[非线性控制理论]9_非线性控制理论串讲

合规、高效,加快药企数字化转型,全新打造药企文档资源中心

23. Update data
随机推荐
Asia Pacific Financial Media | designer universe | Guangdong responds to the opinions of the national development and Reform Commission. Primary school students incarnate as small community designers
在 uniapp 中使用阿里图标
shu mei pai
Vit (vision transformer) principle and code elaboration
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
Nft智能合约发行,盲盒,公开发售技术实战--拼图篇
Data governance: misunderstanding sorting
Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center
Data governance: 3 characteristics, 4 transcendence and 3 28 principles of master data
861. Score after flipping the matrix
08- [istio] istio gateway, virtual service and the relationship between them
C intercept string
Risk planning and identification of Oracle project management system
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
PHP Coding Standard
让学指针变得更简单(三)
onie支持pice硬盘
Wireshark grabs packets to understand its word TCP segment
Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center
数据治理:数据质量篇