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;
dem: Array[‘A’..’Z’] Of Byte;
i:Byte;
ch:Char;
Begin
Write(‘Nhap xau St: ‘); Readln(St);
{Khởi tạo mảng}
For ch:=’A’ To ‘Z’ Do dem[ch]:=0;
{Duyệt xâu}
For i:=1 To Length(St) Do
If Upcase(St[i]) IN [‘A’..’Z’] Then Inc(dem[Upcase(St[i])]);
{Liệt kê các ký tự ra màn hình}
For ch:=’A’ To ‘Z’ Do
If dem[ch]>0 Then Writeln(ch,’ : ’,dem[ch]);
Readln;
uses crt;
var st:string;
begin
clrscr;
write('Nhap xau:'); readln(st);
writeln(length(st));
readln;
end.
Program HOC24;
var s: string;
x: char;
d: byte;
begin
write('Nhap xau: '); readln(s);
write('Nhap ki tu: '); readln(x);
d:=0;
for i:=1 to length(s) do if s[i]=x then d:=d+1;
if d=0 then write('Ki tu do khong xuat hien trong xau') else write('Ki tu do xuat hien trong xau');
readln
end.
Câu 1:
uses crt;
var st:string;
d,i,dem:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
write('Xau sau khi xoa so la: ');
for i:=1 to d do
if not(st[i] in ['0'..'9']) then write(st[i]);
writeln;
dem:=0;
for i:=1 to d do
if st[i]=#32 then inc(dem);
writeln('Xau co ',dem,' dau cach');
writeln('Do dai cua xau la: ',d);
readln;
end.
Câu 2:
uses crt;
const fi='kq.out';
var st1,st2:string;
f1:text;
begin
clrscr;
write('Nhap xau thu 1:'); readln(st1);
write('Nhap xau thu 2:'); readln(st2);
assign(f1,fi); rewrite(f1);
if length(st2)>length(st1) then writeln(f1,st2)
else writeln(f1,st1);
close(f1);
end.
Use crt;
Var S : String;
P: longint;
Begin
Write('Nhap s: '); readln (S);
For P:=length(S) downto 1 do
Write(P);
Readln;
End.
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
writeln('Xau ban vua nhap la: ',st);
writeln('Xau nguoc la: ');
for i:=d downto 1 do
write(st[i]:4);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
string st1,st2;
int d1,d2;
int main()
{
cin>>st1>>st2;
d1=st1.length();
d2=st2.length();
if (d1<d2) cout<<st1;
else cout<<st2;
return 0;
}
uses crt;
var st:string;
d,i:integer;
begin
clrscr;
readln(st);
d:=length(st);
for i:=1 to d do
if not (st[i] in ['0'..'9']) then write(st[i]);
readln;
end.
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau: '); readln(s);
for i:=1 to length(s) do if (s[i]<>#32) and (s[i] in 'A'..'z') then
begin
upcase(s[i]); write(s[i]);
end;
readln
end.
uses crt;
var st:string;
begin
clrscr;
readln(st);
delete(st,3,5);
writeln(st);
readln;
end.