Những câu hỏi liên quan
No_pvp
Xem chi tiết
No_pvp
Xem chi tiết
Lê Tuyết Dình
Xem chi tiết
Anh Thư
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 3 2021 lúc 13:30

uses crt;

var st:string;

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

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

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

a[1]:=st[1];

dem:=1;

for i:=1 to d do 

  begin

kt:=0;

for j:=1 to dem do 

  if st[i]=a[j] 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(a[i],' xuat hien ',dem1,' lan');

end;

readln;

end.

Bình luận (0)
Nguyễn Quốc Anh
27 tháng 2 2023 lúc 23:28

uses crt;

var a:string;

     c:char;

     i,dem:integer;

begin

    clrscr;

    readln(a);

    readln(c);

    dem:=0;

    for i:=1 to length(a) do

    if a[i]=c then dem:=dem+1;

    writeln(dem);

    readln;

end.

 

Bình luận (0)
Lâm Văn Nhựt
Xem chi tiết
Lê Oanh
Xem chi tiết
Nguyễn Lê Phước Thịnh
26 tháng 3 2021 lúc 20:03

uses crt;

var a,b:string;

i,n,d,d1:integer;

begin

clrscr;

write('Nhap xau a:'); readln(a);

write('Nhap xau b:'); readln(b);

if a[length(a)]=b[1] then writeln('Ki tu cuoi cua xau a trung voi ki tu dau cua xau b')

else writeln('Ki tu cuoi cua xau a khong trung voi ki tu dau cua xau b');

dem:=0;

while pos(b,a)>0 do

 begin

inc(dem);

delete(a,pos(b,a),length(b));

end;

writeln('Xau b xuat hien ',dem,' lan trong xau a');

readln;

end.

Bình luận (0)
Duy Nguyễn
Xem chi tiết
HT thai an
Xem chi tiết
Phương Vũ Hà
Xem chi tiết
Nguyễn Lê Phước Thịnh
26 tháng 3 2021 lúc 16:05

uses crt;

var s:string;

i,d:integer;

begin

clrscr;

write('Nhap xau S:'); readln(s);

d:=length(s);

for i:=1 to d do 

  if (s[i] in ['a'..'z']) or (s[i] in ['A'..'Z']) then delete(s,i,1);

writeln('Xau sau khi xoa het ki tu chu la: ',s);

readln;

end.

Bình luận (0)