import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int q = sc.nextInt(); String str = sc.next(); for(int a0 = 0; a0 < q; a0++){ int t = sc.nextInt(); int l = sc.nextInt(); int u = sc.nextInt(); int s=0; if(t==1){ s=sc.nextInt(); StringBuilder sb = new StringBuilder(str); for(int i=l;i<=u;i++){ char c = (char)((sb.charAt(i)-97+1)%26+97); sb.setCharAt(i,c); } //System.out.println(sb.toString()); str = sb.toString(); } if(t==2){ int count = u-l+1; for(int i=l;i<=u;i++){ for(int j=i+1;j<=u;j++){ count+=palin(str.substring(i,j)); System.out.println(str.substring(i,j)+" "+count); } } System.out.println(count); } } } public static int palin(String str){ StringBuilder sb = new StringBuilder(str); if(str.equals(sb.reverse().toString())){ //System.out.print(str); return 1; } return 0; } }