func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ifstream ff( file.txt );     int n, k;     cin >> n >> k;     string s1;     cin >> s1;     n = s1.length();     if (k == 0) {       cout << s1 << endl;       return 0;     }     int j = 0;     bool b1 = false, b2 = false;     for (int i = 0; i < n - 2; i++) {       j++;       if ((i + 1) % 2 != 0 && s1.substr(i, 3) ==  447 ) {         b1 = true;         break;       } else if ((i + 1) % 2 != 0 && s1.substr(i, 3) ==  477 ) {         b2 = true;         break;       }     }     if (b1 == false && b2 == false) {       j++;     }     if (b2 == true) {       j--;     }     for (int i = 0; i < j; i++) {       if (s1.substr(i, 2) ==  47 ) {         if ((i + 1) % 2 == 1) {           s1[i] =  4 ;           s1[i + 1] =  4 ;         } else {           s1[i] =  7 ;           s1[i + 1] =  7 ;         }         k--;       }       if (k == 0) {         cout << s1 << endl;         return 0;       }     }     if (b1 == true) {       if (k % 2 != 0) {         if (j % 2 == 0) {           s1[j] =  4 ;         } else {           s1[j] =  7 ;         }       }     }     if (b2 == true) {       if (k % 2 != 0) {         if (j % 2 == 0) {           s1[j + 1] =  4 ;         } else {           s1[j + 1] =  7 ;         }       }     }     cout << s1 << endl;     return 0;   }   