35657

Untitled

Jun 6th, 2024
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <fstream>
  4.  
  5.  
  6. int main() {
  7.     setlocale(LC_ALL, "ru");
  8.  
  9.     std::ifstream fin("input.txt");
  10.  
  11.     std::string a, b;
  12.  
  13.     fin >> a >> b;
  14.  
  15.     int index = 0, size = a.size();
  16.  
  17.     for (int i = 0; i < b.size(); i++) {
  18.         if (b[i] == a[index]) {
  19.             index++;
  20.             if (index == size) {
  21.                 std::cout << "True" << std::endl;
  22.                 return 0;
  23.             }
  24.         }
  25.     }
  26.     std::cout << "False" << std::endl;
  27.    
  28.  
  29. }
  30.  
  31.  
Advertisement
Add Comment
Please, Sign In to add comment