当前位置:网站首页>1204 character deletion operation (2)

1204 character deletion operation (2)

2022-07-06 07:59:00 Zhanglilong 666

Title Description

 Delete the string after the specified position character m Characters ( Include characters in the specified position ).

Input requirements

Enter two integer numbers in the first line n and m, Respectively represent the... Of the string n Characters ( Non subscript ) And to delete m Characters .

In the second line, enter the original string to be processed .

Output requirements

 Output the processed string .

sample input

7 6
I love movie

sample output

I love

#include<cstdio>
#include<cstring>
int main()
{
	char a[1006];
	int len,i,sum=0,j=0,n,m;
	scanf("%d%d\n",&n,&m);
	gets(a);
	len=strlen(a);
	m=m-1;
	n=n-1;
	for(i=0;i<len;i++){
		if(i<n||i>(m+n)){
			printf("%c",a[i]);
		}
	}
	printf("\n");
}

原网站

版权声明
本文为[Zhanglilong 666]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131849523177.html

随机推荐