#include<iostream>#include<cstdio>#include<cmath>#include<string>#include<cstring>#include<algorithm>#include<limits>#include<vector>#include<stack>#include<queue>#include<set>#include<map>#define INF 0x3f3f3f3fusingnamespace std;typedeflonglong ll;constint maxN =11e4+5;int len;struct node{
string str;int start, length;};
node Manacher(string &s){
string t ="$#";for(int i =0; i < len; i ++){
t += s[i];
t +="#";}
len = t.length();
vector<int>radius(len,0);int mx =0, id =0, Center =0, Len =0;for(int i =1; i < len ; i ++){
radius[i]= mx > i ?min(mx - i , radius[(id <<1)- i]):1;while(i + radius[i]< len && i - radius[i]>=0&& t[i + radius[i]]== t[i - radius[i]])++ radius[i];if(mx < i + radius[i]){
mx = i + radius[i];
id = i;}if(Len < radius[i]){
Len = radius[i];
Center = i;}}return node{s.substr((Center - Len)>>1, Len -1),(Center - Len)>>1, Len -1};}intmain(){char ch[5];
string s;while(~scanf("%s", ch)){
cin >> s;
len = s.length();for(int i =0; i < len; i ++){if(s[i]>= ch[0])
s[i]= s[i]+('a'- ch[0]);else
s[i]='z'+(s[i]- ch[0])+1;}
node ans =Manacher(s);if(ans.length <2)printf("No solution!\n");else{printf("%d %d\n", ans.start, ans.start + ans.length -1);
cout << ans.str << endl;}}return0;}