Những câu hỏi liên quan
Gia Hân
Xem chi tiết
ᴠʟᴇʀ
28 tháng 3 2022 lúc 8:09


var a,b:string;

      i:byte;

begin

write('Nhap xau a: '); readln(a);

for i:=1 to length(a) do

if a[i] in ['0'..'9'] then b:=b+a[i];

write('Xau b la : ',b);

readln 

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
28 tháng 3 2022 lúc 10:05

#include <bits/stdc++.h>

using namespace std;

string st;

int d,i;

int main()

{

getline(cin,st);

d=st.length();

for (i=0; i<=d-1; i++)

{

if (st[i]>=97 && st[i]<=122) st[i]-=32;

}

cout<<st<<endl;

cout<<d;

return 0;

}

Bình luận (0)
Minh Hậu Ngô
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 4 2022 lúc 22:31

2:

#include <bits/stdc++.h>

using namespace std;

string st1,st2;

int d1,d2;

int main()

{

getline(cin,st1);

getline(cin,st2);

d1=st1.length();

d2=st2.length();

if (d1>d2) cout<<st1;

else cout<<st2;

return 0;

}

Bình luận (0)
Nguyễn Mai
Xem chi tiết
Minh Lệ
16 tháng 4 2023 lúc 12:28

Program HOC24;

var i,d1,d2: byte;

st1,st2: string[60];

begin

write('Nhap xau st1: '); readln(st1);

//---------------Câu 1-------------------

d1:=0; d2:=0;

for i:=1 to length(st1) do

begin

if st1[i]='A' then d1:=d1+1;

if st1[i]='a' then d2:=d2+1;

end;

writeln('Co ',d1,' ki tu A trong xau');

writeln('Co ',d2,' ki tu a trong xau');

//---------------------- Câu 2 --------------------

st2:=''

for i:=1 to length(st1) do if st1[i] in ['a'..'z'] then st2:=st2+st1[i];

writeln('Xau st2 la: ',st2);

//------------------------------Câu 3--------------------

for i:=1 to length(st1) do st1[i]:=upcase(st1[i]);

write('Xau st1 sau khi in hoa la: ',st1);

//--------------------------------------------------------

readln

end.

Bình luận (1)
Long ca ca
Xem chi tiết
Minh Lệ
26 tháng 6 2023 lúc 19:38

Program HOC24;
var s: string;
a: array[1..255] of string;
max,d,i: byte;
begin
write('Nhap xau: '); readln(s);
while s[1]=#32 do delete(s,1,1);
while s[length(s)]=#32 do delete(s,length(s),1);
while pos(#32#32,s)<>0 do delete(s,pos(#32#32,s),1);
s:=s+' '
while length(s)<>0 do
begin
d:=d+1;
a[d]:=copy(s,1,pos(#32,s));
delete(s,1,pos(#32,s));
end;
max:=length(a[1]);
for i:=2 to d do
if max<length(a[i]) then max:=length(a[i]);
for i:=1 to d do
if max = length(a[i]) then writeln(a[i]);
readln
end.

Bình luận (0)
Nguyễn Hoàng Duy
27 tháng 6 2023 lúc 9:58

Program HOC24;
uses sysutils;

var s: string;
  words: TStringDynArray;
  max_length, i: integer;
  longest_words: array of string;

begin
  write('Nhap xau: ');
  readln(s);
  words := SplitString(s);
  max_length := 0;
  for i := Low(words) to High(words) do
    if Length(words[i]) > max_length then
      max_length := Length(words[i]);
  SetLength(longest_words, 0);
  for i := Low(words) to High(words) do
    if Length(words[i]) = max_length then
    begin
      SetLength(longest_words, Length(longest_words) + 1);
      longest_words[High(longest_words)] := words[i];
    end;
  writeln('Tu dai nhat trong xau là:');
  for i := Low(longest_words) to High(longest_words) do
    writeln(longest_words[i]);
end.

Bình luận (0)
Be Long
Xem chi tiết
Hai Yen Duong
Xem chi tiết
Ngọc Đối Gaming
Xem chi tiết
Nguyễn Lê Phước Thịnh
3 tháng 12 2021 lúc 22:53

#include <bits/stdc++.h>

using namespace std;

string st;

int d,i;

int main()

{

getline(cin,st);

d=st.length()

for (i=0; i<=d-1; i++)

if (('a'<=st[i]) and (st[i]<='z')) st[i]=st[i]+32;

for (i=0; i<=d-1; i++)

cout<<st[i];

return 0;

}

Bình luận (0)
Vũ Đỗ
Xem chi tiết
Lê Đình Quý
Xem chi tiết
Minh Lệ
16 tháng 3 2023 lúc 22:07

Program HOC24;

var s1,s2: string;

i: byte;

begin

write('Nhap xau S: '); readln(s);

s1:=''

for i:= length(s) downto 1 do

if s[i] in ['A'..'Z'] then s1:=s1+s[i];

write('Xau S1 : ',s1);

readln

end.

Bình luận (0)
LINH VU HA NGOC
Xem chi tiết