提交时间:2026-04-04 18:56:55

运行 ID: 435284

#include<iostream> #include<string> using namespace std; string s1,s2; int n,l1; int main(){ cin>>s1>>s2; l1=s1.size(); for(int i=0;i<l1;i++){ if(s1[i]==s2[0]){ n=i; break; } } int m=l1-n; if(m<l1-m){ cout<<m; }else{ cout<<l1-m; } return 0; }