You are viewing a single comment's thread. Return to all comments →
here is mine approach
using namespace std;
int main() { int t; cin>>t;
while(t--) { string s; cin>>s; int len= s.length(); len= len/2; int no_yes=1, countp; for(int i=0; i<=len;i++) { countp=0; string str=s.substr(0,i+1); stringstream geek(str); long long int temp=0; geek>>temp; long long int rev=temp; int inter=0; string test_t; int t1=0; for(int j=0; j<s.length(); j++) { long long int no=temp,a=0; while(no>0) { no=no/10; a++; } string str_s =s.substr(j,a) ; stringstream gee(str_s); long long int temp1=0; gee>>temp1; if(temp==temp1 ) { inter=inter+a; countp++; } temp++; if(a>=2) j=j+a-1; } if(inter== s.length() &&countp>=2) { cout<<"YES "<<rev<<endl; no_yes=0; break; } } if(no_yes) cout<<"NO"<<endl; }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Separate the Numbers
You are viewing a single comment's thread. Return to all comments →
here is mine approach
include
include
include
using namespace std;
int main() { int t; cin>>t;
}