func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   long long dp[100005][2];   string a, b;   int main() {     int K;     while (cin >> a >> b) {       cin >> K;       memset(dp, 0, sizeof(dp));       if (a == b)         dp[0][1] = 1;       else         dp[0][0] = 1;       int cnt = 0, l = a.length();       a = a + a;       for (int i = 0; i < l; i++)         if (a.compare(i, l, b) == 0) cnt++;       for (int i = 1; i <= K; i++) {         dp[i][1] = (dp[i - 1][1] * (cnt - 1) + dp[i - 1][0] * cnt) % mod;         dp[i][0] =             (dp[i - 1][1] * (l - cnt) + dp[i - 1][0] * (l - cnt - 1)) % mod;       }       cout << dp[K][1] << endl;     }     return 0;   }   