fork download
  1. #include <bits/stdc++.h>
  2. #include <ext/pb_ds/assoc_container.hpp>
  3.  
  4.  
  5. using namespace __gnu_pbds;
  6. using namespace std;
  7.  
  8.  
  9. #define ll long long
  10. #define int long long
  11. #define double long double
  12.  
  13. ll M = 1e9 + 7;
  14.  
  15. ll Fast_pow(ll Base, ll Power, ll M) {
  16. ll Result = 1;
  17.  
  18. while (Power) {
  19. if (Power & 1) {
  20. Result = (Result * Base) % M;
  21. }
  22. Base = (Base * Base) % M;
  23. Power >>= 1;
  24. }
  25. return Result;
  26. }
  27.  
  28.  
  29. void Henry() {
  30. ios_base::sync_with_stdio(false);
  31. cin.tie(nullptr);
  32. cout.tie(nullptr);
  33. }
  34.  
  35.  
  36. void filIO() {
  37. #ifndef ONLINE_JUDGE
  38. freopen("input.txt", "r", stdin);
  39. freopen("output.txt", "w", stdout);
  40. #endif
  41. }
  42.  
  43. string s1, s2;
  44. int ans = 0;
  45. void calc(int i, int cnt) {
  46. if (i == s1.size()) {
  47. ans = max(ans, cnt);
  48. return;
  49. }
  50. if (s1[i] != s2[i]) {
  51. calc(i + 1, cnt);
  52. }else {
  53. calc(i + 1, cnt + 1);
  54. }
  55.  
  56. }
  57.  
  58.  
  59.  
  60. void solve() {
  61. cin >> s1 >> s2;
  62. calc(0, 0);
  63. cout << ans << '\n';
  64. }
  65.  
  66. signed main() {
  67. Henry();
  68. filIO();
  69. int q = 1;
  70. // cin >> q;
  71. while (q--) {
  72. solve();
  73. }
  74. return 0;
  75. }
  76.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
0