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.
uses crt;
var st:string;
d,i,dem:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
while st[1]=#32 do
begin
delete(st,1,1);
d:=length(st);
end;
while st[d]=#32 do
begin
delete(st,d,1);
d:=length(st);
end;
for i:=1 to d do
begin
while (st[i]=#32) and (st[i+1]=#32) do
begin
delete(st,i,1);
d:=length(st);
end;
end;
st[1]:=upcase(st[1]);
for i:=1 to d do
if st[i]=#32 then st[i+1]:=upcase(st[i+1]);
writeln('Ten cua ban sau khi viet dung la: ',st);
dem:=1;
for i:=1 to d do
if st[i]=#32 then inc(dem);
writeln('So tu cua xau la: ',dem);
readln;
end.
string = input("Nhập vào một xâu kí tự: ")
count = string.count('tiền')
print('Xâu kí tự có ', count, 'từ "tiền"')
uses crt;
var s:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau S:'); readln(s);
d:=length(s);
writeln('Cac ki tu so co trong xau S:');
dem:=0;
for i:=1 to d do
if s[i] in ['0'..'9'] then
begin
write(s[i]:4);
inc(dem);
end;
writeln;
writeln('So ki tu chu so co trong xau S: ',dem);
for i:=1 to d do
if s[i] in ['0'..'9'] then s[i]:='A';
writeln('Xau sau khi doi la: ',s);
readln;
end.
Var a: string;
i, Dem: integer;
Begin
writeln(‘nhap xau:’);
Readln(a);
Dem:=0;
For i:=1 to length(a) do
If a[i] =’ ‘ then
Dem:= Dem+1;
Writeln(Dem);
Readln
End.
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.
uses crt;
var s:string;
i,d,dem,dem1,kt:integer;
begin
clrscr;
write('Nhap xau S:'); readln(s);
d:=length(s);
dem:=0;
for i:=1 to d do
if st[i] in ['0'..'9'] then inc(dem);
writeln('So ki tu la chu so la: ',dem);
dem1:=0;
for i:=1 to d do
if (st[i] in ['A'..'Z']) or (st[i] in ['a'..'z']) then inc(dem1);
writeln('So ki tu la chu cai la: ',dem1);
write('Xau sau khi xoa ki tu trang la: ');
for i:=1 to d do
if st[i]<>#32 then write(st[i]);
writeln;
kt:=0;
for i:=1 to d do
if st[i]<>st[d-i+1] then kt:=1;
if kt=0 then writeln('Xau doi xung')
else writeln('Xau khong doi xung');
readln;
end.
program ki_tu;
uses crt;
var s: string;
d,i,n: integer;
begin
clrscr;
write('nhap xau s: ');readln(s);
n:= length(s);
s:=upcase(s);
write('xau s sau khi duoc in hoa la: ');
writeln(s);
d:=0;
for i:= 1 to n do
if s[i] = 'A' then d:= d+1 ;
writeln('chu cai A xuat hien ',d,' lan');
readln
end.
Uses crt;
Var st:string;
D,i,dem:integer;
Begin
Clrscr;
Write('nhap xau:'); readln(st);
D:=length(st);
Dem:=0;
For i:=1 to d do
If st[i]='A' then inc(dem);
Writeln(dem);
Readln;
End.
tham khảo
uses crt;
var a:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau a:'); readln(a);
dem:=0;
d:=length(a);
for i:=1 to d do
if a[i]=' ' then inc(dem);
writeln(dem);
readln;
end.