Untitled
user_5668965
python
13 days ago
291 B
1
Indexable
Never
Var a,l,r:array[1..1000000] of longint; s:string; i,m,k:longint; begin Readln(s); for i:=2 to length(s) do begin if s[i]=s[i-1] then inc(k); a[i]:=k; end; Readln(m); for i:=1 to m do Readln(l[i],r[i]); for i:=1 to m do Writeln(a[r[i]]-a[l[i]]); end.
Leave a Comment