CSES - Datatähti 2017 alku - Results
Submission details
Task:Pakkaus
Sender:charmakr
Submission time:2016-10-09 10:08:06 +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

// DatatahtiA.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
//freopen("input2.txt", "r", stdin);
string s,temp_char,output;
int temp_num = 0;;
getline(cin, s);
for (int i = 0; i < s.length(); i++) {
int num_l = 0;
int char_l = 0;
for (int a = 0; a < s.length(); a++) {
if (isdigit(s[i+a])) {
num_l++;
}
else { break; }
}
for (int a = 0; a < s.length(); a++) {
if (isalpha(s[i +num_l+ a])) {
char_l++;
}
else { break; }
}
temp_char = s.substr(i + num_l, char_l);
temp_num = stoi(s.substr(i , num_l));
for (int a = 0; a < temp_num; a++) {
output += temp_char;
//cout << temp_char;
}
i += num_l + char_l-1;
num_l = 0;
char_l = 0;
}
cout << output;
return 0;
}