Submission details
Task:Merkkijono
Sender:Ilmari2000
Submission time:2018-01-18 12:29:52 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.05 sdetails
#2--details
#3--details
#4--details
#5--details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:31:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 1; i < str.size(); i++)
                    ^
input/code.cpp:42:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < coms.size(); i++)
                   ^

Code

#include <iostream>
#include <vector>
using namespace std;
int main()
{
string str;
cin >> str;
vector<string> coms;
bool nb = true;
while(nb)
{
if(str[0] > str[1])
{
coms.push_back("SWAP");
char tmp = str[0];
str[0] = str[1];
str[1] = tmp;
}
else
{
str = str[str.size() - 1] + str;
str.resize(str.size() - 1);
coms.push_back("MOVE");
}
nb = false;
for(int i = 1; i < str.size(); i++)
{
if(str[i-1] > str[i])
{
nb = true;
break;
}
}
}
cout << coms.size() << endl;
for(int i = 0; i < coms.size(); i++)
cout << coms[i] << endl;
}

Test details

Test 1

Verdict: ACCEPTED

input
ABCDEFGHIJKLMNOPQRSTUVWXYZ

correct output
0

user output
50
MOVE
SWAP
MOVE
SWAP
...

Test 2

Verdict:

input
ZYXWVUTSRQPONMLKJIHGFEDCBA

correct output
923
MOVE
MOVE
SWAP
MOVE
...

user output
(empty)

Test 3

Verdict:

input
RPJMFWBHYQOTXUAENLDGZISCVK

correct output
611
SWAP
MOVE
MOVE
SWAP
...

user output
(empty)

Test 4

Verdict:

input
GWJSPBHANMXYFLKIDORVUCEZQT

correct output
659
MOVE
SWAP
MOVE
SWAP
...

user output
(empty)

Test 5

Verdict:

input
BJYNFLKEIUCZMQHRAXOGWPSDTV

correct output
624
MOVE
SWAP
MOVE
SWAP
...

user output
(empty)