func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string fld;     cin >> fld;     int l = 1, r = 2 * n;     int ans = -1;     while (l <= r) {       int mid = (l + r) >> 1;       int posbl = 1;       int back = -1, flag = 0;       for (int i = 0; i < n; i++) {         if (fld[i] ==  * )           if (i > back && flag == 0) back = i, flag = 1;         if (fld[i] ==  P ) {           if (back == -1) {             back = i + mid;           } else {             if (i <= back) {               back = max(back, i + mid);             } else {               if (flag == 1) {                 if (i - back > mid) {                   posbl = 0;                   break;                 } else if (i - back <= mid && mid <= (2 * (i - back)))                   back = max(i, (mid - (i - back)) / 2 + i);                 else {                   back =                       max(mid - (2 * (i - back)) + i, (mid - (i - back)) / 2 + i);                 }               } else {                 back = i + mid;               }             }           }           flag = 0;         }       }       if (flag == 1) posbl = 0;       if (posbl == 1) {         r = mid - 1;         ans = mid;       } else         l = mid + 1;     }     cout << ans <<   n ;     return 0;   }   