local N, Q, _ = io.read("n", "n", "l")
local S = io.read("l")
for i=1,Q do
    local l, r = io.read("n", "n")
    local ss = string.sub(S, l, r)
    local _, count = string.gsub(ss, 'AC', '!!')
    print(count)
end
