C++,利用STL中的copy直接输出
截取字符串
http://www.nowcoder.com/practice/a30bbc1a0aca4c27b86dd88868de4a4a
#include<bits/stdc++.h>
using namespace std;
int main(){
string str;
while(cin>>str){
int n;
cin>>n;
copy(str.begin(),str.begin()+n,ostream_iterator<char>(cout));
cout<<endl;
}
}