algorithms

Algorithm implementations
git clone git://git.laack.co/algorithms.git
Log | Files | Refs | README

t2.cpp (413B)


      1 #include <iostream>
      2 #include <string>
      3 
      4 int main() {
      5     std::string a, b;
      6     std::cin >> a;
      7     std::cin >> b;
      8 
      9     long res = 0;
     10 
     11     for(int x = 0; x < a.size(); ++x) {
     12 
     13         auto current = a[x];
     14         int ub = b.size() - (a.size() - x);
     15 
     16         for(int i = x; i <= ub; ++i) {
     17             if(current != b[i]) {
     18                 res += 1;
     19             }
     20         }
     21     }
     22     std::cout << res << std::endl;
     23 }