当前位置:网站首页>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);
}
}边栏推荐
- Description of octomap averagenodecolor function
- WebRTC系列-H.264预估码率计算
- Epoll and IO multiplexing of redis
- 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
- Golang DNS 随便写写
- Notes on software development
- C # display the list control, select the file to obtain the file path and filter the file extension, and RichTextBox displays the data
- 洛谷P1836 数页码 题解
- Simulation of holographic interferogram and phase reconstruction of Fourier transform based on MATLAB
- PHP Coding Standard
猜你喜欢

A Closer Look at How Fine-tuning Changes BERT

MEX有关的学习

Pangolin Library: control panel, control components, shortcut key settings

Uibehavior, a comprehensive exploration of ugui source code

Understanding of law of large numbers and central limit theorem

"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

Go learning notes (3) basic types and statements (2)

Solution: intelligent site intelligent inspection scheme video monitoring system

Apache middleware vulnerability recurrence

数据治理:主数据的3特征、4超越和3二八原则
随机推荐
【Redis】NoSQL数据库和redis简介
Opencv learning notes 9 -- background modeling + optical flow estimation
Le chemin du navigateur Edge obtient
你想知道的ArrayList知识都在这
flask返回文件下载
A Closer Look at How Fine-tuning Changes BERT
Description of octomap averagenodecolor function
C # display the list control, select the file to obtain the file path and filter the file extension, and RichTextBox displays the data
MySQL view tablespace and create table statements
[untitled]
edge瀏覽器 路徑獲得
Sanzi chess (C language)
Qualitative risk analysis of Oracle project management system
让学指针变得更简单(三)
Helm install Minio
解决方案:智慧工地智能巡檢方案視頻監控系統
Nc204382 medium sequence
File upload of DVWA range
2.10transfrom attribute
将 NFT 设置为 ENS 个人资料头像的分步指南