雙指針之基礎例題

#include<iostream>
#include<string.h>

using namespace std;
int main(){
	char str[10000];
	
	gets(str);

	int n = strlen(str);

	for(int i = 0;i < n;i++){
		int j = i;
		while(j < n && str[j] != ' ') j++;

		for(int k = i;k < j;k++){
			cout << str[k];
		}
		cout << endl;
		i = j;
	}
	return 0;
}
相關文章
相關標籤/搜索