func_code_string: #include <bits/stdc++.h>   using namespace std;   int l[100000], r[100000], u[100000], d[100000];   int dp[2], dp2[2];   int main() {     int i;     int n, m, q;     char c;     scanf( %d %d %d , &n, &m, &q);     for (i = 0; i < n; i++) scanf(  %c , &c), l[i] = (c ==  B );     for (i = 0; i < n; i++) scanf(  %c , &c), r[i] = (c ==  B );     for (i = 0; i < m; i++) scanf(  %c , &c), u[i] = (c ==  B );     for (i = 0; i < m; i++) scanf(  %c , &c), d[i] = (c ==  B );     for (i = 0; i < n; i++) dp[!l[i]]++;     dp[!u[0]]++, dp[!d[0]]++;     for (i = 1; i < m; i++) {       dp2[0] = min(dp[0], dp[1] + n) + u[i] + d[i];       dp2[1] = min(dp[1], dp[0] + n) + !u[i] + !d[i];       swap(dp, dp2);     }     for (i = 0; i < n; i++) dp[!r[i]]++;     int ans = min(dp[0], dp[1]);     dp[0] = dp[1] = 0;     for (i = 0; i < m; i++) dp[!u[i]]++;     dp[!l[0]]++, dp[!r[0]]++;     for (i = 1; i < n; i++) {       dp2[0] = min(dp[0], dp[1] + m) + l[i] + r[i];       dp2[1] = min(dp[1], dp[0] + m) + !l[i] + !r[i];       swap(dp, dp2);     }     for (i = 0; i < m; i++) dp[!d[i]]++;     ans = min(ans, min(dp[0], dp[1]));     printf( %d n , ans);     return 0;   }   