poj3916 Duplicate Removal

Posted on 2011-08-09 12:57  hell0World  阅读(195)  评论(0)    收藏  举报
//poj3916 Duplicate Removal
#include<iostream>
#include<fstream>
using namespace std;
int main (int argc, char **argv)
{
	/*fstream cin(argv[1]);*/
	int n;
	int i;
	int before;
	int now;
	while(cin>>n)
	{
		if (n ==0)
			break;
		cin>>before;
		cout<<before<<" ";
		for(i =0; i < n-1; i++)
		{
			cin>>now;
			if(now!=before)
				cout<<now<<" ";
			before=now;
		}
		cout<<"$"<<endl;
	}
	
	/*cin.close();*/
	return 0;
}