jakaria_hossain

codeforces - short substring

Jun 18th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define fast()(ios_base::sync_with_stdio(0),cin.tie(NULL));
  5. int main()
  6. {
  7.     fast()
  8.     int t;
  9.     cin>>t;
  10.     while(t--)
  11.     {
  12.         string s,sub;
  13.         cin>>s;
  14.         sub.push_back(s[0]);
  15.         bool f=true;
  16.         for(int i=1;i<s.size()-1;i++)
  17.         {
  18.             if(f)
  19.             {
  20.                 sub.push_back(s[i]);
  21.                 f= false;
  22.             }
  23.             else f=true;
  24.  
  25.         }
  26.         sub.push_back(s[s.size()-1]);
  27.         cout<<sub<<endl;
  28.     }
  29. }
Add Comment
Please, Sign In to add comment