K
Khách

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.

23 tháng 3 2023

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)

10 tháng 5 2021

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.

25 tháng 7 2021

uses crt;

var s:string;

i,tong,x,code:integer;

f,g:text;

k:boolean;

const fi='XAU.INP';

          fo='XAU.OUT';

begin

k:=false;

assign(f,fi); reset(f);

assign(g,fo); rewrite(g);

readln(f,s);

tong:=0;

for i:=1 to length(s) do

begin

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

begin

k:=true;

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

tong:=tong+x;

x:=0;

cod:=0;

end;

end;

if k=false then writeln(g,'Sai yeu cau')

else

begin

writeln(g,s);

writeln(g,tong);

end;

close(f);

close(g);

end.

16 tháng 4 2023

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.

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.