ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1654. Cipher Message

Dear autors or another users, i got WA#5, where is my bug ?
Posted by Borisov Sergey 30 Oct 2012 12:29
this my solution:

#include <iostream>
#include <string>
#include <stdlib.h>
#include <algorithm>

using namespace std;

int main(){

int bilo;
string s;
cin>>s;


for (int j = 0; j < s.length() - 1; j++){
    bilo = 0;
    for (int i = 0; i < s.length()-1; i++){
      if (s[i] != '1')
        if ((s[i] == s[i+1])){
          s[i] = '1';
          s[i+1] = '1';
          bilo = 1;

          if (i < s.length()-1){
          rotate(&s[i], &s[i+1], &s[i] + s.length() - i);
          rotate(&s[i], &s[i+1], &s[i] + s.length() - i);
          }

        }
     }
  if (bilo = 0)
      break;
}

int i = 0;
while (s[i]!='1'){
    cout<<s[i];
    i++;
}


   //system("pause");
    return 0;
}

please send me answer on my e-mail: sergeo_91_@mail.ru  or write me here.
P.S. thank you in advance.