Những câu hỏi liên quan
Khánh Mỹ
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 4 2021 lúc 19:21

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.

Bình luận (0)
Hai Yen Duong
Xem chi tiết
Harunastu
Xem chi tiết
Minh Lệ
18 tháng 1 2021 lúc 19:40

Program HOC24;

var s: string;

tg,d,max,i: byte;

code: integer;

begin

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

// cau a

for i:=1 to length(s) do if s[i] in ['a'..'z'] then write(upcase(s[i]));

//------

writeln;

//-cau b

for i:=length(s) downto 1 do if s[i] in ['0'..'9'] then write(s[i]);

//------

writeln;

//---cau c

d:=0;

for i:= 1 to length(s) do

if s[i] in ['0'..'9'] then 

begin

val(s[i],tg,code);

if tg>max then max:=tg;

d:=d+1;

end;

if d=0 then write('Khong co chu so trong day') else write('Chu so lon nhat la : ',max);

readln 

end.

Bình luận (1)
Nguyễn Lê Phước Thịnh
18 tháng 1 2021 lúc 21:32

uses crt;

var st,st1:string;

d,i,d1,max,x,y:integer;

begin

clrscr;

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

d:=length(st);

writeln('Day cac ki tu thuong doi sang chu hoa la: ');

for i:=1 to d do 

  if st[i] in ['a'..'z'] then write(upcase(st[i]):4);

st1:=''

for i:=1 to d do 

  if st[i] in ['0'..'9'] then st1:=st1+st[i];

d1:=length(st1);

for i:=d1 downto 1 do 

  write(st1[i]:4);

writeln;

max:=0;

for i:=1 to d1 do 

  begin

val(st1[i],x,y);

if max<x then max:=x;

end;

writeln('Chu so lon nhat trong xau la: ',max);

readln;

end.

Bình luận (1)
Khánh Mỹ
Xem chi tiết
Nguyễn Lê Phước Thịnh
3 tháng 3 2021 lúc 19:46

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

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

d:=length(st);

writeln('Xau vua nhap la: ',st);

for i:=1 to d do 

  if st[i] in ['a'..'z'] then upcase(st[i]);

writeln(st);

readln;

end.

Bình luận (0)
Nguyễn Hoàng Nam
Xem chi tiết
Nguyễn Lê Phước Thịnh
15 tháng 3 2022 lúc 22:17

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

readln(st);

d:=length(st);

for i:=1 to d do 

  if (st[i]='a') or (st[i]='A') then st[i]:='b'

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
Do Ngoc Thao My
Xem chi tiết
Ngô Bá Hùng
16 tháng 4 2023 lúc 20:15

program ChuyenXauSangChuThuong;
var
  str: string; 
  i: integer; 

begin
  write('Nhap mot xau ky tu: ');
  readln(str); 
  for i := 1 to Length(str) do
    str[i] := LowerCase(str[i]); 
  writeln('Xau ky tu chuyen thanh chu thuong la: ', str); 
end.

Bình luận (0)
Coming Home
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 5 2021 lúc 9:56

uses crt;

const fi='dulieu.txt'

var f1:text;

st:string;

i,d:integer;

begin

clrscr;

assign(f1,fi); rewrite(f1);

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

d:=length(st);

for i:=1 to d do 

if (st[i] in ['A'..Z']) or (st[i] in ['0'..'9']) or (st[i]=#32) then write(f1,st[i]);

close(f1);

end.

Bình luận (0)