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.
program DemKiTuTrongXau;
uses crt;
var
s: string;
i, count: integer;
begin
clrscr;
write('Nhap vao mot xau: ');
readln(s);
count := 0;
for i := 1 to length(s) do
begin
if s[i] <> ' ' then
count := count + 1;
end;
writeln('So luong ki tu trong xau la: ', count);
readln;
end.
uses crt;
var s:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap chuoi S:'); readln(s);
d:=length(s);
writeln('Trong chuoi ',s,' co ',d,' ki tu');
writeln('Chuoi dao cua chuoi ',s,' la: ');
for i:=d downto 1 do
write(s[i]:4);
writeln;
dem:=0;
for i:=1 to d do
if s[i] in ['0'..'9'] then inc(dem);
writeln('So chu so trong xau la: ',dem);
readln;
end.
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.
Program HOC24;
var s,st: string;
i,n,max: integer;
a: array[1..1000] of string;
begin
write('Nhap xau: '); readln(s);
s:=s+' '; n:=1;
while length(s)<>0 do
begin
n:=n+1;
a[n]:=copy(s,1,pos(' ',s));
delete(s,1,pos(' ',s));
end;
max:=length(a[1]);
for i:=2 to n do if max<length(a[i]) then
begin
max:=length(a[i]);
st:=a[i];
end;
write('Tu co do dai lon nhat trong xau la: ',st);
readln
end.
var s,st: string;
i,n,max: integer;
a: array[1..1000] of string;
begin
write('Nhap xau: '); readln(s);
s:=s+' '; n:=1;
while length(s)<>0 do
begin
n:=n+1;
a[n]:=copy(s,1,pos(' ',s));
delete(s,1,pos(' ',s));
end;
max:=length(a[1]);
for i:=2 to n do if max<length(a[i]) then
begin
max:=length(a[i]);
st:=a[i];
end;
write('Tu co do dai lon nhat trong xau la: ',st);
readln
end.
uses crt;
var s1,s2:string;
i,j,d1,d2:integer;
begin
clrscr;
readln(s1,s2);
d1:=length(s1);
d2:=length(s2);
for i:=1 to d1 do
if not(s1[i] in ['0'..'9']) then delete(s1,i,1);
for i:=1 to d2 do
if not(s2[i] in ['0'..'9']) then delete(s2,i,1);
writeln(s1);
writeln(s2);
writeln(s1+s2);
readln;
end.
Program hotrotinhoc;
var s: string;
t,c,i: byte;
begin
write('Nhap s:'); readln(s);
t:=0;
for i:=1 to length(s) do
if s[i] in ['1'..'9'] then
begin
val(s[i],c);
t:=t+c;
end;
write(t);
readln
end.
Thu gọn