当前位置:网站首页>Intercept string (function)
Intercept string (function)
2022-06-11 15:19:00 【Psychic hacker】
Title Description
Programming , Its effect is , From string 1 ( The length exceeds 30) Of the index Copy all characters starting with characters , Generate a new string 2.
Input
Number of groups of test data n
The first set of data
The second set of data
........
Output
The substring will be output after successful generation , Failed to generate , Output "IndexError"
sample input
3
Zhenshen University
9
www.szu.edu.cn
12
apple
8
sample output
University
cn
IndexError
Code
#include<iostream>
#include<string>
using namespace std;
int main()
{
int t,i;
string a;
cin>>t;
while(t--)
{
getchar();
getline(cin,a);
int index;
cin>>index;
if(index>=a.size())
cout<<"IndexError"<<endl;
else
{
for(i=index;a[i];i++)
cout<<a[i];
cout<<endl;
}
}
}边栏推荐
- High number_ Chapter 6 infinite series__ Marklaurin series
- 回溯法/解空间树 排列树
- Implementation of the function of recording login status
- PowerShell chief architect: I used my spare time to develop projects, but I was demoted by Microsoft because of my excellent performance
- What is excess product power? Find the secret key of the second generation cs75plus in the year of the tiger
- Square and storage box (linear DP)
- In the "ten billion blue ocean" database, each player can find a boat | c-position face-to-face
- 02 _ Log system: how does an SQL UPDATE statement execute?
- CNCF survey in 2021: a year for kubernetes to cross the gap
- Qualcomm WLAN framework learning (29) -- 6GHz overview
猜你喜欢

深度剖析「圈組」關系系統設計 | 「圈組」技術系列文章

数据库优化

Don't you understand the design and principle of thread pool? Break it up and crush it. I'll teach you how to design the thread pool

Devil cold rice # 037 devil shares the ways to become a big enterprise; Female anchor reward routine; Self discipline means freedom; Interpretation of simple interest and compound interest

回溯法/解空间树 排列树

Oauth2的理解

Qualcomm WLAN framework learning (29) -- 6GHz overview

See from the minute, carve on the details: Exploration of SVG generated vector format website icon (favicon)

Hebei huangjinzhai scenic spot adds "AED automatic defibrillator" to ensure the life safety of tourists!

对于事务的认识
随机推荐
01discussion on Tekton
Hamad application layout scheme 02 of hashicopy
基于 GateWay 和 Nacos 实现微服务架构灰度发布方案
Uniapp settings page Jump effect - navigateto switching effect - Global animationtype animation
Knowledge of affairs
With a loss of 13.6 billion yuan in three years, can listing revive Weima?
Riskscanner of multi Cloud Security compliance scanning platform
How to batch insert 100000 pieces of data
河北 黄金寨景区新增“AED自动除颤器”保障游客生命安全!
uniapp開發微信小程序,從構建到上線
3年亏损136亿,上市能救活威马吗?
02 _ 日志系统:一条SQL更新语句是如何执行的?
[process blocks and methods of SystemVerilog] ~ domain, always process block, initial process block, function, task, life cycle
JVM基础概念入门
Installation and use of sonarqube
LoveLive! Published an AI paper: generating models to write music scores automatically
Flutter 3.0正式发布:稳定支持6大平台,字节跳动是主要用户
如何做好自媒体?这几个步骤你做对了吗?
Database optimization
Summary of redis basic knowledge