Untitled diff

Created Diff never expires
35 removals
Lines
Total
Removed
Words
Total
Removed
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
38 lines
27 additions
Lines
Total
Added
Words
Total
Added
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
31 lines
#include <bits/stdc++.h>
#include<iostream>
#include<string>
#include <sstream>
using namespace std;
using namespace std;

char a[1000][4];
int a[9999][9999];
stringstream h;

int main() {
int main() {
string s, s1, s2;
// freopen ( "input1.txt","r",stdin ) ;
char t;
string s,s1,s2; char t; int n,m,l=0,kol=0;
int n, m ,l = 0, k = 0;
cin >>s; stringstream c; c.clear();
cin >> s;
for (int i=6;i<s.length()-1;++i) {
h.clear();
s1="";
for (int i = 6; i < s.length() - 1; ++i) {
if (s[i]=='(') {++l; a[l][1]='('; a[l][2]=i;}
s1 = "";
if (s[i]==')') {
if (s[i] == '(') {
++kol; cout <<'_'<<kol<<'=';
++l;
for (int j=a[l][2]-1;j<=i;++j) {cout <<s[j]; } cout <<endl;
a[l][1] = '(';
s.erase (a[l][2]-1,i-(a[l][2]-2));
a[l][2] = i;
c<<kol;
}
c>>s2;
if (s[i] == ')') {
c.clear();
++k;
s1=s1+"_"+s2;
cout << '_' << k << '=';
//cout <<s1<<endl;
for (int j = a[l][2]-1; j <= i; ++j) {
s.insert (a[l][2]-1,s1);
cout << s[j];
i=a[l][2]-1+s1.length()-1;
}
//cout <<i<<endl;
cout << endl;
//a[l-1][2]=
s.erase(a[l][2] - 1, i - (a[l][2] - 2));
//cout <<s<<endl;
h << k;
--l;
h >> s2;
h.clear();
s1 = s1 + "_" + s2;
s.insert (a[l][2] - 1, s1);
i = a[l][2] - 1 + s1.length() - 1;
--l;
}
}
}
}
cout << s <<endl;
cout <<s<<endl;
}
}