PTA 基础编程题目集 7-32 说反话-加强版

#include<iostream>
#include<string>
using namespace std;
int main(){
	int i, arry[200000] = {0,0};
	char c;
	string str[200000];
	for (i =1;; i++)
	{
		c = getchar();
		if (c == ' ')
		  {
			if (arry[i] == 0)
				i--;
		  }
		else if (c == '\n')
		{
			if (arry[i] == 0)
				i--;
			break;
		}
		else
		{
			str[i] += c; arry[i] = 1; i--;
		}
	}
	for (int j = i; j >0; j--)
	{
		if (j != i) 
			cout << ' ';
		cout << str[j];
	}
}

上一篇:SQL 必知必会(学习笔记一)


下一篇:在程序中定义字符串