substring(zoho)

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> using namespace std; int fn(char c[]) { int s; s=0; for(int i=0;c[i]!='\0';i++) s++; return s; } int main() { char a[100],b[100]; cin>>a>>b; int size1,size2,i,j,ct=0,ct1=1; size1=fn(a); size2=fn(b); for(i=0;i<size1;i++) { j=0; ct=0; while(a[i]==b[j]&&i<size1) { ct++; i++; j++; } if(ct==size2) { cout<<i-ct; ct1=0; break; } } if(ct1==1) cout<<"sorry"; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines