CSES - Datatähti 2018 alku - Results
Submission details
Task:Merkkijono
Sender:Challe
Submission time:2017-10-09 22:16:39 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp:4:20: fatal error: stdafx.h: No such file or directory
 #include "stdafx.h"
                    ^
compilation terminated.

Code

// ConsoleApplication2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <vector>
#include <iostream>
#include <string>

using namespace std;

vector<string> Funktio(string mjono)
{
	vector<string> jonot;
	string kirjain;
	int num = 0;
	int num2 = 0;
	while (num < mjono.length()) {
		kirjain.push_back(mjono.at(num));
		jonot.push_back(kirjain);
		if (num + 1 == mjono.length()) {
			break;
		}
		while (mjono.at(num) == mjono.at(num + 1)) {
			jonot[num2].push_back(mjono.at(num));
			num++;
		}
		num2++;
		num++;
		kirjain.clear();
	}
	return jonot;
}

vector<string> Funktio2(vector<string> jonot) 
{
	int num = 0;
	while (num < jonot.size()) {
		if (jonot[num].length() > 1) {
			jonot.erase(jonot.begin() + num);
		}
		else {
			num++;
		}
	}
	return jonot;
}

int main()
{
	string mjono;
	cin >> mjono;
	vector<string> jonot;
	vector<string> jonot2;
	jonot = Funktio(mjono);
	jonot2 = Funktio2(jonot);
	for (int c = 0; c < jonot2.size(); c++) {
		cout << jonot2[c] << "\n";
	}

	cin >> mjono;
    return 0;
}