1094 Problems: processing input and output character string
Time limit: 1Sec Memory limit: 64MB submission: 4843 Resolution: 1538
Title Description
String input and output processing.
Entry
The first line is a positive integer N, a maximum of 100. After the string is a plurality of rows (number of lines greater than N), each line of the string may contain spaces, no more than 1000 characters.
Export
Before the first N rows of the input character string (which may contain spaces) is output, then the rest of the string (containing space) divided in space or carriage return output sequentially in rows. Outputs a blank line between each line of output.
Sample input
2
www.dotcpp.com DOTCPP
A C M
D O T CPP
Sample Output
www.dotcpp.com DOTCPP
A C M
D
O
T
CPP
#include <stdio.h>
#include <string.h>
int main(){
char str[1100];
int t;
scanf("%d",&t);
getchar();
while(t--){
/*
用gets的字符串可以带空格
而scanf不能带空格,字符串必须是连续没有空格的,有空格的隔开的就是另一字符串;
*/
gets(str);///注意:不能用scanf("%s",str);
puts(str);
puts("");
}
while(scanf("%s",str)!=EOF){
puts(str);
puts("");
}
return 0;
}