-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbroken_keyboard.cpp
More file actions
38 lines (34 loc) · 855 Bytes
/
Copy pathbroken_keyboard.cpp
File metadata and controls
38 lines (34 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <bits/stdc++.h>
using namespace std;
int main()
{
string frase;
list<char> texto;
list<char>::iterator it;
while(getline(cin,frase))
{
texto.clear();
it = texto.begin();
for(int i=0;i<frase.size();++i)
{
if(frase[i] == '<'){
if(texto.empty())
continue;
else{
texto.pop_back();
//it--;
}
}
if(frase[i]=='[')
it = texto.begin();
if(frase[i]==']')
it = texto.end();
if(frase[i]!='[' && frase[i]!=']' && frase[i] != '<')
texto.insert(it,frase[i]);
}
for(it=texto.begin();it!=texto.end();it++)
printf("%c",*it);
printf("\n");
}
return 0;
}