import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		int N = nextInt();
		int Q = nextInt();
		String S = nextString();
		char[] c = S.toCharArray();
		int[] a = new int[N];
		a[0]=0;
		for(int i=1;i<N;i++){
			if(c[i-1]=='A'&&c[i]=='C'){
				a[i]=1;
			}else{
				a[i]=0;
			}
		}
		int[] b = new int[N];
		b[0]=0;
		for(int i=1;i<N;i++){
			b[i]=b[i-1]+a[i];
		}


		for(int i=0;i<Q;i++){
			int l=nextInt();
			int r=nextInt();
			System.out.println(b[r-1]-b[l-1]);
		}

	}

	public static long[] disassemblyAlph(String s) {
		long[] alph = new long['z' - 'a' + 1];
		Arrays.fill(alph, 0);
		for (int i = 0; i < s.length(); i++) {
			alph[s.charAt(i) - 'a']++;
		}
		return alph;
	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


} import java.io.*; io.* java import java.util.*; util.* java public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		int N = nextInt();
		int Q = nextInt();
		String S = nextString();
		char[] c = S.toCharArray();
		int[] a = new int[N];
		a[0]=0;
		for(int i=1;i<N;i++){
			if(c[i-1]=='A'&&c[i]=='C'){
				a[i]=1;
			}else{
				a[i]=0;
			}
		}
		int[] b = new int[N];
		b[0]=0;
		for(int i=1;i<N;i++){
			b[i]=b[i-1]+a[i];
		}


		for(int i=0;i<Q;i++){
			int l=nextInt();
			int r=nextInt();
			System.out.println(b[r-1]-b[l-1]);
		}

	}

	public static long[] disassemblyAlph(String s) {
		long[] alph = new long['z' - 'a' + 1];
		Arrays.fill(alph, 0);
		for (int i = 0; i < s.length(); i++) {
			alph[s.charAt(i) - 'a']++;
		}
		return alph;
	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


} Main final static long MOD = 1000000007L; MOD 1000000007L public static String[] Ws = null; Ws null public static int wsIndx = 0; wsIndx 0 public static BufferedReader in = null; in null public static ArrayList<int[]> list = new ArrayList<>(); list new ArrayList<>() public static void main(String[] args) throws Exception {

		int N = nextInt();
		int Q = nextInt();
		String S = nextString();
		char[] c = S.toCharArray();
		int[] a = new int[N];
		a[0]=0;
		for(int i=1;i<N;i++){
			if(c[i-1]=='A'&&c[i]=='C'){
				a[i]=1;
			}else{
				a[i]=0;
			}
		}
		int[] b = new int[N];
		b[0]=0;
		for(int i=1;i<N;i++){
			b[i]=b[i-1]+a[i];
		}


		for(int i=0;i<Q;i++){
			int l=nextInt();
			int r=nextInt();
			System.out.println(b[r-1]-b[l-1]);
		}

	} main {

		int N = nextInt();
		int Q = nextInt();
		String S = nextString();
		char[] c = S.toCharArray();
		int[] a = new int[N];
		a[0]=0;
		for(int i=1;i<N;i++){
			if(c[i-1]=='A'&&c[i]=='C'){
				a[i]=1;
			}else{
				a[i]=0;
			}
		}
		int[] b = new int[N];
		b[0]=0;
		for(int i=1;i<N;i++){
			b[i]=b[i-1]+a[i];
		}


		for(int i=0;i<Q;i++){
			int l=nextInt();
			int r=nextInt();
			System.out.println(b[r-1]-b[l-1]);
		}

	} int N = nextInt(); N nextInt() nextInt int Q = nextInt(); Q nextInt() nextInt String S = nextString(); S nextString() nextString char[] c = S.toCharArray(); c S.toCharArray() S.toCharArray S int[] a = new int[N]; a new int[N] N a[0]=0 a[0] a 0 0 for(int i=1;i<N;i++){
			if(c[i-1]=='A'&&c[i]=='C'){
				a[i]=1;
			}else{
				a[i]=0;
			}
		} int i=1; int i=1; i 1 i<N i N i++ i++ i {
			if(c[i-1]=='A'&&c[i]=='C'){
				a[i]=1;
			}else{
				a[i]=0;
			}
		} {
			if(c[i-1]=='A'&&c[i]=='C'){
				a[i]=1;
			}else{
				a[i]=0;
			}
		} if(c[i-1]=='A'&&c[i]=='C'){
				a[i]=1;
			}else{
				a[i]=0;
			} c[i-1]=='A'&&c[i]=='C' c[i-1]=='A' c[i-1] c i-1 i 1 'A' c[i]=='C' c[i] c i 'C' {
				a[i]=1;
			} a[i]=1 a[i] a i 1 {
				a[i]=0;
			} a[i]=0 a[i] a i 0 int[] b = new int[N]; b new int[N] N b[0]=0 b[0] b 0 0 for(int i=1;i<N;i++){
			b[i]=b[i-1]+a[i];
		} int i=1; int i=1; i 1 i<N i N i++ i++ i {
			b[i]=b[i-1]+a[i];
		} {
			b[i]=b[i-1]+a[i];
		} b[i]=b[i-1]+a[i] b[i] b i b[i-1]+a[i] b[i-1] b i-1 i 1 a[i] a i for(int i=0;i<Q;i++){
			int l=nextInt();
			int r=nextInt();
			System.out.println(b[r-1]-b[l-1]);
		} int i=0; int i=0; i 0 i<Q i Q i++ i++ i {
			int l=nextInt();
			int r=nextInt();
			System.out.println(b[r-1]-b[l-1]);
		} {
			int l=nextInt();
			int r=nextInt();
			System.out.println(b[r-1]-b[l-1]);
		} int l=nextInt(); l nextInt() nextInt int r=nextInt(); r nextInt() nextInt System.out.println(b[r-1]-b[l-1]) System.out.println System.out System System.out b[r-1]-b[l-1] b[r-1] b r-1 r 1 b[l-1] b l-1 l 1 String[] args args public static long[] disassemblyAlph(String s) {
		long[] alph = new long['z' - 'a' + 1];
		Arrays.fill(alph, 0);
		for (int i = 0; i < s.length(); i++) {
			alph[s.charAt(i) - 'a']++;
		}
		return alph;
	} disassemblyAlph {
		long[] alph = new long['z' - 'a' + 1];
		Arrays.fill(alph, 0);
		for (int i = 0; i < s.length(); i++) {
			alph[s.charAt(i) - 'a']++;
		}
		return alph;
	} long[] alph = new long['z' - 'a' + 1]; alph new long['z' - 'a' + 1] 'z' - 'a' + 1 'z' - 'a' 'z' 'a' 1 Arrays.fill(alph, 0) Arrays.fill Arrays alph 0 for (int i = 0; i < s.length(); i++) {
			alph[s.charAt(i) - 'a']++;
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			alph[s.charAt(i) - 'a']++;
		} {
			alph[s.charAt(i) - 'a']++;
		} alph[s.charAt(i) - 'a']++ alph[s.charAt(i) - 'a'] alph s.charAt(i) - 'a' s.charAt(i) s.charAt s i 'a' return alph; alph String s s public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	} toStringArray {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	} String[] tmp = new String[s.length()]; tmp new String[s.length()] s.length() s.length s char[] c = s.toCharArray(); c s.toCharArray() s.toCharArray s for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		} int i = 0; int i = 0; i 0 i < tmp.length i tmp.length tmp tmp.length i++ i++ i {
			tmp[i] = String.valueOf(c[i]);
		} {
			tmp[i] = String.valueOf(c[i]);
		} tmp[i] = String.valueOf(c[i]) tmp[i] tmp i String.valueOf(c[i]) String.valueOf String c[i] c i return tmp; tmp String s s public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	} concatStringArray {
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	} StringBuffer sb = new StringBuffer(); sb new StringBuffer() for(String x:s){
			sb.append(x);
		} String x s {
			sb.append(x);
		} {
			sb.append(x);
		} sb.append(x) sb.append sb x return sb.toString(); sb.toString() sb.toString sb String[] s s public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	} check {
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	} if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		} in == null in null {
			in = new BufferedReader(new InputStreamReader(System.in));
		} in = new BufferedReader(new InputStreamReader(System.in)) in new BufferedReader(new InputStreamReader(System.in)) if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		} Ws==null || Ws.length<=wsIndx Ws==null Ws null Ws.length<=wsIndx Ws.length Ws Ws.length wsIndx {
			Ws = in.readLine().split(" ");
			wsIndx=0;
		} Ws = in.readLine().split(" ") Ws in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " wsIndx=0 wsIndx 0 public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	} nextInt {
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	} check() check return Integer.parseInt(Ws[wsIndx++]); Integer.parseInt(Ws[wsIndx++]) Integer.parseInt Integer Ws[wsIndx++] Ws wsIndx++ wsIndx public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	} nextLong {
		check();
		return Long.parseLong(Ws[wsIndx++]);
	} check() check return Long.parseLong(Ws[wsIndx++]); Long.parseLong(Ws[wsIndx++]) Long.parseLong Long Ws[wsIndx++] Ws wsIndx++ wsIndx public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	} nextString {
		check();
		return Ws[wsIndx++];
	} check() check return Ws[wsIndx++]; Ws[wsIndx++] Ws wsIndx++ wsIndx public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	} nextInts {
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	} check() check int[] tmp = new int[Ws.length]; tmp new int[Ws.length] Ws.length Ws Ws.length for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		} int i=0; int i=0; i 0 i<tmp.length i tmp.length tmp tmp.length i++ i++ i {
			tmp[i]=Integer.parseInt(Ws[i]);
		} {
			tmp[i]=Integer.parseInt(Ws[i]);
		} tmp[i]=Integer.parseInt(Ws[i]) tmp[i] tmp i Integer.parseInt(Ws[i]) Integer.parseInt Integer Ws[i] Ws i wsIndx=Ws.length wsIndx Ws.length Ws Ws.length return tmp; tmp public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	} nextLongs {
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	} check() check long[] tmp = new long[Ws.length]; tmp new long[Ws.length] Ws.length Ws Ws.length for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		} int i=0; int i=0; i 0 i<tmp.length i tmp.length tmp tmp.length i++ i++ i {
			tmp[i]=Long.parseLong(Ws[i]);
		} {
			tmp[i]=Long.parseLong(Ws[i]);
		} tmp[i]=Long.parseLong(Ws[i]) tmp[i] tmp i Long.parseLong(Ws[i]) Long.parseLong Long Ws[i] Ws i wsIndx=Ws.length wsIndx Ws.length Ws Ws.length return tmp; tmp public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	} nextStrings {
		check();
		wsIndx=Ws.length;
		return Ws;
	} check() check wsIndx=Ws.length wsIndx Ws.length Ws Ws.length return Ws; Ws public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		int N = nextInt();
		int Q = nextInt();
		String S = nextString();
		char[] c = S.toCharArray();
		int[] a = new int[N];
		a[0]=0;
		for(int i=1;i<N;i++){
			if(c[i-1]=='A'&&c[i]=='C'){
				a[i]=1;
			}else{
				a[i]=0;
			}
		}
		int[] b = new int[N];
		b[0]=0;
		for(int i=1;i<N;i++){
			b[i]=b[i-1]+a[i];
		}


		for(int i=0;i<Q;i++){
			int l=nextInt();
			int r=nextInt();
			System.out.println(b[r-1]-b[l-1]);
		}

	}

	public static long[] disassemblyAlph(String s) {
		long[] alph = new long['z' - 'a' + 1];
		Arrays.fill(alph, 0);
		for (int i = 0; i < s.length(); i++) {
			alph[s.charAt(i) - 'a']++;
		}
		return alph;
	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


} public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		int N = nextInt();
		int Q = nextInt();
		String S = nextString();
		char[] c = S.toCharArray();
		int[] a = new int[N];
		a[0]=0;
		for(int i=1;i<N;i++){
			if(c[i-1]=='A'&&c[i]=='C'){
				a[i]=1;
			}else{
				a[i]=0;
			}
		}
		int[] b = new int[N];
		b[0]=0;
		for(int i=1;i<N;i++){
			b[i]=b[i-1]+a[i];
		}


		for(int i=0;i<Q;i++){
			int l=nextInt();
			int r=nextInt();
			System.out.println(b[r-1]-b[l-1]);
		}

	}

	public static long[] disassemblyAlph(String s) {
		long[] alph = new long['z' - 'a' + 1];
		Arrays.fill(alph, 0);
		for (int i = 0; i < s.length(); i++) {
			alph[s.charAt(i) - 'a']++;
		}
		return alph;
	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


} Main
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		int N = nextInt();
		int Q = nextInt();
		String S = nextString();
		char[] c = S.toCharArray();
		int[] a = new int[N];
		a[0]=0;
		for(int i=1;i<N;i++){
			if(c[i-1]=='A'&&c[i]=='C'){
				a[i]=1;
			}else{
				a[i]=0;
			}
		}
		int[] b = new int[N];
		b[0]=0;
		for(int i=1;i<N;i++){
			b[i]=b[i-1]+a[i];
		}


		for(int i=0;i<Q;i++){
			int l=nextInt();
			int r=nextInt();
			System.out.println(b[r-1]-b[l-1]);
		}

	}

	public static long[] disassemblyAlph(String s) {
		long[] alph = new long['z' - 'a' + 1];
		Arrays.fill(alph, 0);
		for (int i = 0; i < s.length(); i++) {
			alph[s.charAt(i) - 'a']++;
		}
		return alph;
	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}