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.
Program hotrotinhoc;
var s: string;
t,c,i: byte;
begin
write('Nhap s:'); readln(s);
t:=0;
for i:=1 to length(s) do
if s[i] in ['1'..'9'] then
begin
val(s[i],c);
t:=t+c;
end;
write(t);
readln
end.
Thu gọn
uses crt;
var s1,s2:string;
i,j,d1,d2:integer;
begin
clrscr;
readln(s1,s2);
d1:=length(s1);
d2:=length(s2);
for i:=1 to d1 do
if not(s1[i] in ['0'..'9']) then delete(s1,i,1);
for i:=1 to d2 do
if not(s2[i] in ['0'..'9']) then delete(s2,i,1);
writeln(s1);
writeln(s2);
writeln(s1+s2);
readln;
end.
PROGRAM XAU;
USES crt;
VAR N1 ; N2 : String;
a ; i :Bytbe;
BEGIN
clrscr;
write(' Nhap xau N1:') ; Readln(N1);
N2:=' ';
for i:=1 to Length(N1) do
If ( 'a'<=N1
moa cai dau doi ty qua kia lam
Program HOC24;
var s,st: string;
i,n,max: integer;
a: array[1..1000] of string;
begin
write('Nhap xau: '); readln(s);
s:=s+' '; n:=1;
while length(s)<>0 do
begin
n:=n+1;
a[n]:=copy(s,1,pos(' ',s));
delete(s,1,pos(' ',s));
end;
max:=length(a[1]);
for i:=2 to n do if max<length(a[i]) then
begin
max:=length(a[i]);
st:=a[i];
end;
write('Tu co do dai lon nhat trong xau la: ',st);
readln
end.
var s,st: string;
i,n,max: integer;
a: array[1..1000] of string;
begin
write('Nhap xau: '); readln(s);
s:=s+' '; n:=1;
while length(s)<>0 do
begin
n:=n+1;
a[n]:=copy(s,1,pos(' ',s));
delete(s,1,pos(' ',s));
end;
max:=length(a[1]);
for i:=2 to n do if max<length(a[i]) then
begin
max:=length(a[i]);
st:=a[i];
end;
write('Tu co do dai lon nhat trong xau la: ',st);
readln
end.
#include <bits/stdc++.h>
using namespace std;
string a[1000],t,ln;
int n,i;
int main()
{
cin>>n;
for (i=1;i<=n; i++) cin>>a[i];
ln='';
for (i=1; i<=n; i++) if (ln<a[i]) ln=a[i];
t='';
for (i=1; i<=n; i++) t=t+a[i];
cout<<ln<<" "<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
string a,b;
void replaceSubstring(string& a, const string& b) {
size_t pos=0;
while((pos=a.find(b,pos))!=string::npos) {
a.replace(pos,b.length(),"ABC");
pos+=3;
}
}
int main()
{
cin>>a>>b;
if(a.find(b)!=string::npos){
cout<<"YES"<<endl;
replaceSubstring(a,b);
cout<<a;
}else{
cout<<"NO"<<endl;
cout<<a;
}
return 0;
}
#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]==' ') and (st[i+1]=' ')) st.erase(i,1);
cout<<st;
return 0;
}
uses crt;
var s1,s2:string;
begin
clrscr;
readln(s1,s2);
writeln(s1+s2);
writeln(length(s1+s2));
readln;
end.