Given a string in which the letter h occurs at least twice. Remove from that string the first and the last occurrence of the letter h, as well as all the characters between them.
var a:string;
var i,c,b:integer;
begin
readln(a);
b:=100;
c:=0;
for i:= 0 to length(a) do
if a[i]='h' then
if b>i then
b:=i;
for i:= 0 to length(a) do
if a[i]='h' then
if c<i then
c:=i;
for i:= b to c do
delete(a,i,i);
writeln(a);
end.
Input (stdin)
In the hole in the ground there lived a hobbit
Your Output (stdout)
In tlhdib
Expected Output
In tobbit


83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?