#include <iostream>
#include <fstream>
#include <string>

using namespace::std;

int main () {

	string temp;
	string line="";
	int y=0;
	int beginning=0, end=0;
	int counter=0;
	int linelength=0;

	ifstream infile("DATA2.txt");
	ofstream outfile("OUT2.txt",ios::out);

	do {
		getline(infile,temp);
//cout << temp;
		for (int i=0; i < temp.length(); i++) { //for the length of the string, do this:
			if ((temp[i] == '/') && (temp[i+1] == '/')/*&& (temp[i+1] <= temp.length())*/) {
				beginning = i+2;
				end = temp.length();
				line += temp.substr(beginning, end);
				line += " ";
				i = temp.length();
			}
			else if (temp[i] == '"') { //find "
				for (int j=i+1; j < temp.length(); j++) {	//if you find it, do this:
					if (temp[j] == '"') {			//find the corresponding "
						beginning = i+1;
						end = (j-1)-i;
						i = j;
						j = temp.length();		//so that we can continue the search, hopefully
						line += temp.substr(beginning, end);
						line += " ";
					}
				}
			}
			else if (temp[i] == '\'') {		//find '
				for (int k=i+1; k < temp.length(); k++) {	//if you find it, do this:
					if (temp[k] == '\'') {			//find the corresponding '
						beginning = i+1;
						end = (k-1)-i;
						i = k;	
						k = temp.length();			//so that we can continue the search, hopefully
						line += temp.substr(beginning, end);
						line += " ";
					}
				}
			}
			else if ((temp[i] == '/') && (temp[i+1] == '*')) { //if the next is *
				for (int n=i+2; n < temp.length(); n++) {	//if you find it, do this:
					if (temp[n] == '*') {			//find the corresponding "
						if (temp[n+1] == '/') { //if the next is /
							beginning = i+2;
							end = (n - 2)-i;
							i = n;
							n = temp.length();
							line += temp.substr(beginning, end);
							line += " ";
						}

					}
				}
			}
		}
//cout << line;


	
	linelength = line.length();
	if (linelength > 0)
	linelength--;
//cout << linelength << endl;

		if (counter <=1)
			line.erase(linelength,2);

		outfile << line << endl;
		line = "";
		counter = 0;
		linelength = 0;
		y++;	
	} while (y<5);

return(0);			
}

