func_code_string: #include <bits/stdc++.h>   using namespace std;   string s;   int find_47(const string& s, int from) {     for (int i = from; i < (s.size() - 1); i++) {       if ((s[i] ==  4 ) && (s[i + 1] ==  7 )) return i;     }     return -1;   }   int main() {     int n, k;     cin >> n >> k;     cin >> s;     int from = 0;     while (true) {       if (k == 0) break;       int ind = find_47(s, from);       if (ind == -1) break;       if (ind % 2 == 0) {         if (ind + 2 >= n) {           s[ind + 1] =  4 ;           break;         }         if (s[ind + 2] ==  7 ) {           if (k % 2 == 1) s[ind + 1] =  4 ;           break;         } else {           s[ind + 1] =  4 ;           k--;           from = ind + 2;         }       } else {         if (s[ind - 1] ==  4 ) {           if (k % 2 == 1) s[ind] =  7 ;           break;         } else {           s[ind] =  7 ;           k--;           from = ind + 1;         }       }     }     cout << s << endl;     return 0;   }   