Code Submission Evaluation System Login

CSES - HIIT Open 2017

HIIT Open 2017

Contest start:2017-05-27 11:00:00
Contest end:2017-05-27 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard


History
2017-05-27 11:40:56
2017-05-27 11:38:04
Task:Dynamic duo
Sender:Ace of Spades
Submission time:2017-05-27 11:40:56
Status:READY
Result:ACCEPTED

Show test data

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:13:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int64_t i = 0; i < s.size()/2; ++i) {
                                      ^
input/code.cpp:17:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int64_t i = 0; i < s.size()/2; ++i) {
                                      ^

Code

#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(void) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());

    string s1, s2;
    for (int64_t i = 0; i < s.size()/2; ++i) {
	s1+=s[i];
	s2+=s[s.size()/2+i];
    }
    for (int64_t i = 0; i < s.size()/2; ++i) {
	if (s1[i] == s2[i]) {
	    cout << "-1\n";
	    return 0;
	}
    }
    cout << s1 << "\n" << s2 << "\n";
    return 0;
}