Problem link: http://www.spoj.com/problems/STRHH/
#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;
}
}
#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;
}
}
output not in the required format.....
ReplyDeleteshould use a 2d array and loops.
ReplyDeleteI found the solution on internet
ReplyDeletehttp://mrodpg.blogspot.in/2017/02/spoj-solution-tag-strhh-half-of-half.html
how to solve this problem in c
ReplyDelete