K
Khách

Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

15 tháng 5 2020

Program HOC24;

const fi='Hoten.inp';

fo='tu.out';

var ht: string;

f: text;

d,i: integer;

procedure ip;

begin

assign(f,fi);

reset(f);

read(f,ht);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

d:=0;

while ht[1]=#32 do delete(ht,1,1);

while ht[length(ht)]=#32 do delete(ht,length(ht),1);

while pos(#32#32,ht)<>0 do delete(ht,pos(#32#32,ht),1);

for i:=1 to length(ht) do if ht[i]=' ' then d:=d+1;

write(f,d+1);

close(f);

end;

begin

ip;

out;

end.

D
datcoder
CTVVIP
17 tháng 11 2023

#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;

}

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.

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.

const fi='input.txt';

fo='output.txt';

var f1,f2:text;

st:string[125];

a:array[1..125]of string;

i,d,dem,kt,j:integer;

begin

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

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

readln(f1,st);

d:=length(st);

dem:=1;

a[1]:=st[1];

for i:=1 to d do

  begin

kt:=0;

for j:=1 to dem do 

  if a[j]=st[i] then kt:=1;

if kt=0 then 

begin

inc(dem);

a[dem]:=st[i];

end;

end;

for i:=1 to dem do 

  begin

dem1:=0;

for j:=1 to d do 

if a[i]=st[j] then inc(dem1);

writeln(f2,a[i],' xuat hien ',dem1,' lan');

end;

close(f1);

close(f2);

end.