Những câu hỏi liên quan
Lala
Xem chi tiết
datcoder
17 tháng 11 2023 lúc 0:18

#include <bits/stdc++.h>

using namespace std;

int main() {

freopen("VIRUS.INP","r",stdin);

freopen("VIRUS.OUT","w",stdout);

string S, R;

cin >> S >> R;

while(S.find(R) >= 0) {

int p = S.find(R);

if (p >= 0) S.erase(p,R.length());

else break;

}

cout<<S;

return 0;

}

Bình luận (0)
Lan Phuong
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 4 2022 lúc 16:53

const fi='demxau.inp',

fo='demxau.out'

var f1,f2:text;

st:string;

d,i,dem:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,st);

d:=length(st);

dem:=0;

for i:=1 to d do 

  if st[i]=' ' then dem:=dem+1;

writeln(f2,dem+1);

close(f1);

close(f2);

end.

Bình luận (0)
nguyen dao
Xem chi tiết
Nguyễn Lê Phước Thịnh
7 tháng 5 2021 lúc 21:09

const fi='vao.inp'

fo='ra.out'

var f1,f2:text;

st:string;

i,d:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,st);

d:=length(st);

for i:=1 to d do 

  if st[i]='a' then delete(st,i,1);

writeln(f2,st);

close(f1);

close(f2);

end.

Bình luận (0)
Ngô Chí Thành
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 4 2021 lúc 9:40

Uses crt;

Var st:string;

I,d:integer;

Begin

Clrscr;

Write('nhap xau:'); readln(st);

D:=length(st);

While st[d]=#32 do

Begin

Delete(st,d,1);

D:=length(st);

End;

For i:=1 to d do

If (st[i]=#32) and (st[i+1]=#32) then delete(st,i,1);

Writeln(st);

Readln;

End.

Bình luận (0)
Ngô Chí Thành
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 4 2021 lúc 9:29

Uses crt;

Var st:string;

I,d:integer;

Begin

Clrscr;

Write('nhap xau:'); readln(st);

D:=length(st);

While st[d]=#32 do

  Begin

Delete(st,d,1);

D:=length(st);

End;

For i:=1 to d do

  If (st[i]=#32) and (st[i+1]=#32) then delete(st,i,1);

Writeln(st);

Readln;

End.

Bình luận (0)
Do Ngoc Thao My
Xem chi tiết
Do Ngoc Thao My
Xem chi tiết
HT thai an
Xem chi tiết
nhat hoang
Xem chi tiết