Tuesday 22 December 2015

Half of the half


#include<iostream>
#include<string.h>
using namespace std;
int main(){
int t,n,i=0;
cin>>t;
while(t--){
string s;
cin>>s;
n=s.length()/2; while(i<n)
{
cout<<s[i];
i+=2;
}
cout<<endl;
i=0;
}

}

4 comments:

  1. output not in the required format.....

    ReplyDelete
  2. should use a 2d array and loops.

    ReplyDelete
  3. I found the solution on internet
    http://mrodpg.blogspot.in/2017/02/spoj-solution-tag-strhh-half-of-half.html

    ReplyDelete