### Saratov State University :: Online Contester

::Go
- home
- news
- register
 - update personal info
 - problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- projects

 ::Poll Are you registered on Codeforces?YesNoWhat is it???[results]

::webboard

Author: Cimon
ID: 056184
Problem: 397
Contest: 0
Date: 2014-10-26 22:22:38

hi, this is my code for sgu 397. I used linked list and it works for lots of testes. but I dont know why do I still get wrong answer?!

#include <iostream>
#include <string>
#include <vector>

using namespace std;

struct Node{
char val;
Node *next;
Node *before;
};

//FirstNodeMaking:D
}

//InsertAfterCursor
{
Node *newNode = new Node;
newNode->val = n;

//Last Node
{
newNode->next = NULL;
}
//Not Last Node
else
{
}
}

int main(){
string s;
cin >> s;
bool flag = false;
bool cursorIsFirst = false;

for(int i=0; i<s.size(); i++)
{
if( s[i]=='L' && flag )
{
Node *temp = new Node;

cursorIsFirst = true;

else
}
else if( s[i]=='R' && flag)
{
cursorIsFirst = false;
}
else if(!flag && s[i]!='L' && s[i]!='R')
{
flag = true;
}
else if(flag)
{
if( cursorIsFirst )
{
Node *temp = new Node;
temp->val = s[i];
temp->before = NULL;
cursorIsFirst = false;
}
else
{
}
}
}

//Showing OutPut;
while( cur->before && flag )
cur = cur->before;

while( cur && flag )//!flag: momkene reshte faghat az L R bashe
{
cout << cur->val ;
cur = cur->next;
}
if( flag )
cout << endl;
return 0;
}