K
Khách

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 <bits/stdc++.h>

using namespace std;

string st;

int d,i;

int main()

{

cin>>st;

cout<<st<<endl;

d=st.length();

for (i=d-1; i>=0; i--) cout<<st[i];

cout<<endl;

for (i=0; i<d; i++) cout<<st[i]<<endl;

return 0;

}

3 tháng 5 2022

Program HOC24;

var s: string;

i: byte;

begin

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

//----------------CAU A

for i:=1 to length(s) do writeln(s[i]);

//-------------------CAU B

for i:=length(s) downto 1 do writeln(s[i]);

readln

end.

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

readln(st);

d:=length(st);

for i:=d downto 1 do 

  write(st[i]);

readln;

end.

16 tháng 4 2023

program stringManipulation;

var
  st1, st2: string;
  countN, i: integer;

begin
  write('Nhap vao xau ki tu st1: ');
  readln(st1);
  countN := 0;
  for i := 1 to length(st1) do
  begin
    if (st1[i] = 'N') or (st1[i] = 'n') then
    begin
      countN := countN + 1;
    end;
  end;
  writeln('So ky tu N va n trong xau st1 la: ', countN);
  st2 := '';
  for i := 1 to length(st1) do
  begin
    if (st1[i] >= 'A') and (st1[i] <= 'Z') then
    begin
      st2 := st2 + st1[i];
    end;
  end;
  writeln('Cac ky tu in hoa trong xau st1 la: ', st2);
  write('Xau st1 viet theo chieu nguoc lai la: ');
  for i := length(st1) downto 1 do
  begin
    write(st1[i]);
  end;
  readln;
end.

16 tháng 4 2023

st1 = input("Nhập vào xâu kí tự: ")
count_n = 0
st2 = ""
for char in st1:
    if char == 'N' or char == 'n':
        count_n += 1
    if char.isupper():
        st2 += char

print("Số lần xuất hiện của kí tự 'N' và 'n' là:", count_n)
print("Xâu kí tự chỉ chứa kí tự in hoa là:", st2)
print("Xâu kí tự đảo ngược là:", st1[::-1])

31 tháng 3 2023

Câu 1:

ho_ten = input("Nhập họ tên: ")

tach_ho_ten = ho_ten.split()

if len(tach_ho_ten) > 1:

     ten = tach_ho_ten[-1]

     print("Tên của bạn là:", ten)

else:

     print("Nhập sai định dạng họ tên")

Câu 2: 

s = input("Nhập xâu: ")

hoa = s.upper()

print(hoa)

14 tháng 3 2023

Mn giúp vs 

28 tháng 3 2022


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.

#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;

}

3 tháng 3 2021

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.