当前位置:网站首页>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);
}
}边栏推荐
- PHP - Common magic method (nanny level teaching)
- 1015 reversible primes (20 points) prime d-ary
- onie支持pice硬盘
- opencv学习笔记八--答题卡识别
- Generator Foundation
- 解决方案:智慧工地智能巡檢方案視頻監控系統
- Notes on software development
- Data governance: metadata management
- 649. Dota2 Senate
- Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center
猜你喜欢

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

A Closer Look at How Fine-tuning Changes BERT

Secure captcha (unsafe verification code) of DVWA range

How to prevent Association in cross-border e-commerce multi account operations?

Sanzi chess (C language)

wincc7.5下载安装教程(Win10系统)

Wireshark grabs packets to understand its word TCP segment

Asia Pacific Financial Media | art cube of "designer universe": Guangzhou community designers achieve "great improvement" in urban quality | observation of stable strategy industry fund

将 NFT 设置为 ENS 个人资料头像的分步指南

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
随机推荐
Inspiration from the recruitment of bioinformatics analysts in the Department of laboratory medicine, Zhujiang Hospital, Southern Medical University
Solution: intelligent site intelligent inspection scheme video monitoring system
[count] [combined number] value series
链表面试题(图文详解)
octomap averageNodeColor函数说明
Key value judgment in the cycle of TS type gymnastics, as keyword use
让学指针变得更简单(三)
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
P3047 [usaco12feb]nearby cows g (tree DP)
软件开发的一点随记
Google may return to the Chinese market after the Spring Festival.
Circuit breaker: use of hystrix
. Net 6 learning notes: what is NET Core
esRally国内安装使用避坑指南-全网最新
Wireshark grabs packets to understand its word TCP segment
MES, APS and ERP are essential to realize fine production
Description of octomap averagenodecolor function
"Designer universe" APEC design +: the list of winners of the Paris Design Award in France was recently announced. The winners of "Changsha world center Damei mansion" were awarded by the national eco
Position() function in XPath uses
opencv学习笔记八--答题卡识别