Viết chương trình nhập một xâu từ bàn phím (xâu nhập vào có kí tự chứ cái in, chữ cái thường và kí tự số) Yêu cầu:lọc và in các chữ cái thường có trong xâu
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.
![](https://rs.olm.vn/images/avt/0.png?1311)
![](https://rs.olm.vn/images/avt/0.png?1311)
Var a: string;
i, Dem: integer;
Begin
writeln(‘nhap xau:’);
Readln(a);
Dem:=0;
For i:=1 to length(a) do
If (‘a’<=a[i]) and (a[i]<=’z’)
Dem:= Dem+1;
Writeln(Dem);
Readln
End.
![](https://rs.olm.vn/images/avt/0.png?1311)
uses crt;
var st:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
dem:=0;
for i:=1 to d do
if (st[i] in ['a'..'z']) or (st[i] in ['A'..'Z']) then inc(dem);
writeln(dem);
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
2:
uses crt;
var st:string;
d,i,dem1,dem2:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
dem1:=0;
dem2:=0;
for i:=1 to d do
begin
if st[i] in ['0'..'9'] then inc(dem1);
if (st[i] in ['a'..'z']) or (st[i] in ['A'..'Z']) then inc(dem2);
end;
writeln('So ki tu la chu so la: ',dem1);
writeln('So ki tu la chu cai la: ',dem2);
for i:=1 to d do
if st[i] in ['0'..'9'] then delete(st,i,1);
writeln('Xau sau khi xoa cac chu so la: ',st);
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
uses crt;
var a,b:string;
i,d:integer;
begin
clrscr;
write('Nhap xau a:'); readln(a);
d:=length(a);
b:='';
for i:=1 to d do
if a[i] in ['A'..'Z'] then b:=b+a[i];
writeln(b);
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
xau = input('Nhập xâu kí tự: ')
chu_cai, chu_so, ki_tu_khac = 0, 0, 0
for kt in xau:
if kt.isalpha():
chu_cai += 1
elif kt.isdigit():
chu_so += 1
else:
ki_tu_khac += 1
print('Số lượng kí tự chữ cái:', chu_cai)
print('Số lượng kí tự chữ số:', chu_so)
print('Số lượng kí tự khác:', ki_tu_khac)
![](https://rs.olm.vn/images/avt/0.png?1311)
Program Xau;
Uses crt;
Var St: String;
i: longint;
Begin
Clrscr;
Write('Nhap xau: '); Readln(St);
For i:=1 to length(St) do
St[i] := Upcase(St[i]);
Write('St = ',St);
Readln
End.
Program HOC24;
var s: string;
begin
write('Nhap xau: '); readln(s);
write('Xau sau khi loc: ');
for i:=1 to length(s) do
if s[i] in ['A'..'z'] then write(s[i]);
readln
end.