Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- typedef long long ll;
- using namespace std;
- int GLOBAL_CNT = 0;
- int main(){
- string s;
- bool f = false;
- bool add = false;
- int cnt = 0;
- vector<string> ans;
- vector<string> tmp;
- while(getline(cin, s)){
- //if (s[0] == '.') break;
- if (f){
- if (s == "<tr>") {
- if (add && !tmp.empty()){
- string tmp2;
- bool fl = false;
- for (int i = 0; i < tmp[1].size()-1; ++i){
- if (tmp[1][i] == '>'){
- tmp2 += tmp[1][i];
- tmp2 += to_string(GLOBAL_CNT);
- fl = true;
- }
- if (tmp[1][i] == '<') fl = false;
- if (!fl)
- tmp2 += tmp[1][i];
- }
- tmp2 += '>';
- tmp[1] = tmp2;
- for (int i = 0; i < tmp.size(); ++i){
- ans.push_back(tmp[i]);
- }
- }
- cnt = 0;
- tmp.clear();
- tmp.push_back(s);
- add = false;
- }
- else {
- cnt++;
- if (cnt == 2 && s.substr(s.find(','), 4) == ", 10") {
- add = true; GLOBAL_CNT++;
- }
- tmp.push_back(s);
- }
- }
- if (!f) ans.push_back(s);
- if (s == "<tbody>") f = true;
- if (s == "</tbody>") {
- f = false;
- ans.push_back(s);
- }
- }
- for (int i = 0; i < ans.size(); ++i){
- cout << ans[i];
- if (i != ans.size()-1) cout << '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement