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.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string st;
int dai,i,kt;
cout<<"Nhap chuoi:"; getline(cin,st);
dai=st.length();
kt=0;
for (int i=0;i<dai;i++)
if (st[i]!=st[dai-i-1]) kt=1;
if (kt==0) cout<<"YES";
else cout<<"NO";
return 0;
}
program bai_10_chuong_4;
uses crt;
var
s: string[100];
i, dem: integer;
Begin
clrscr;
write('Nhap xau vao:'); readln(s); dem:= 0;
for i:= 1 to length(s) do
if ('0'<=s[i]) and(s[i]<=’9') then dem:=dem+l;
Writeln('Trong xau s co '»dem,' chu so thap phan');
readln;
End.
uses crt;
var st:string[100];
i,d,kt:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
kt:=0;
for i:=1 to length(st) do
if st[i]<>st[length(st)-i+1] then kt:=1;
if kt=0 then write('Xau doi xung')
else writeln('Xau khong doi xung');
readln;
end.
uses crt;
const fi='xau.txt';
var f1:text;
s:string;
i,d,kt:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,s);
d:=length(s);
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.
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
readln(st);
d:=length(st);
for i:=1 to d do
begin
if st[i]=' ' then writeln
else write(st[i]);
end;
readln;
end.
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.
program superSymmetricalSubstring;
var
s: string;
function isSymmetrical(str: string): boolean;
var
i, len: integer;
begin
len := length(str);
for i := 1 to len div 2 do
begin
if str[i] <> str[len - i + 1] then
begin
exit(false);
end;
end;
exit(true);
end;
function countSuperSymmetricalSubstrings(s: string): integer;
var
i, j, len, count: integer;
begin
len := length(s);
count := 0;
for i := 1 to len do
begin
for j := 2 to len - i + 1 do
begin
if isSymmetrical(copy(s, i, j)) then
begin
count := count + 1;
end;
end;
end;
count := count + len;
exit(count);
end;
begin
write('Nhap xau S: ');
readln(s);
writeln('So xau con sieu doi xung cua S: ', countSuperSymmetricalSubstrings(s));
readln;
end.
sao mình chạy nó ra 12 v bạn