Những câu hỏi liên quan
Nguyễn Thị Ngọc Minh
Xem chi tiết
Nguyễn Lê Phước Thịnh
29 tháng 1 2021 lúc 22:18

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.

Bình luận (0)
Trần Thị Thúy Hằng
Xem chi tiết
Họ Và Tên
Xem chi tiết
Nguyễn Lê Phước Thịnh
12 tháng 1 2021 lúc 21:16

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. 

Bình luận (1)
Nguyen Dao
Xem chi tiết
Phía sau một cô gái
23 tháng 2 2023 lúc 21:58

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"')

Bình luận (0)
Hiếu
Xem chi tiết
Nguyễn Lê Phước Thịnh
29 tháng 3 2021 lúc 21:36

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.

Bình luận (0)
Nguyễn Cảnh Hùng
Xem chi tiết
Đỗ Ngọc Trinh
30 tháng 4 2017 lúc 16:06

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.

Bình luận (0)
Lê Tuyết Dình
Xem chi tiết
Phương Vũ Hà
Xem chi tiết
Nguyễn Lê Phước Thịnh
26 tháng 3 2021 lúc 16:05

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.

Bình luận (0)
Trần Nguyễn NhưÝ
Xem chi tiết
Nguyễn Lê Phước Thịnh
1 tháng 5 2021 lúc 19:44

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.

Bình luận (0)