Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
NgocTuan
Xem chi tiết
Nguyễn Lê Phước Thịnh
23 tháng 1 2022 lúc 20:08

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

}

LINH VU HA NGOC
Xem chi tiết
Khánh Mỹ
Xem chi tiết
Nguyễn Lê Phước Thịnh
3 tháng 3 2021 lúc 19:46

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

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

d:=length(st);

writeln('Xau vua nhap la: ',st);

for i:=1 to d do 

  if st[i] in ['a'..'z'] then upcase(st[i]);

writeln(st);

readln;

end.

Asuna
Xem chi tiết
Coming Home
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 5 2021 lúc 9:56

uses crt;

const fi='dulieu.txt'

var f1:text;

st:string;

i,d:integer;

begin

clrscr;

assign(f1,fi); rewrite(f1);

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

d:=length(st);

for i:=1 to d do 

if (st[i] in ['A'..Z']) or (st[i] in ['0'..'9']) or (st[i]=#32) then write(f1,st[i]);

close(f1);

end.

Nguyễn Hạnh
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 4 2021 lúc 19:21

uses crt;

var s:string;

i,d,dem1,dem2,dem3,dem4:integer;

begin

clrscr;

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

d:=length(s);

dem1:=0;

dem2:=0;

dem3:=0;

dem4:=0;

for i:=1 to d do 

  begin

if st[i] in ['0'..'9'] then inc(dem1)

else if st[i] in ['a'..'z'] then inc(dem2)

else if st[i] in ['A'..'Z'] then inc(dem3)

else inc(dem4);

end;

writeln('So luong ky tu so la: ',dem1);

writeln('So luong ky tu thuong la: ',dem2);

writeln('So luong ky tu hoa la: ',dem3);

writeln('So luong ky tu dac biet la: ',dem4);

readln;

end.

NGUYỄN VIẾT LUẬN
Xem chi tiết
Nguyễn An
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 7 2021 lúc 14:32

uses crt;

var s,s1,s2:string;

i,d:integer;

begin

clrscr;

readln(s);

s1:=''

s2:=''

d:=length(s);

for i:=1 to d do

  begin

if s[i] in ['0'..'9'] then s1:=s1+s[i];

if (s[i] in ['a'..'z']) or (s[i] in ['A'..'Z']) then s2:=s2+s[i];

end;

writeln('Xau chua cac ki tu so la: ',s1);

writeln('Xau chua cac ki tu chu la: ',s2);

readln;

end.

luc lun
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 12 2021 lúc 23:09

#include <bits/stdc++.h>
using namespace std;
int d,i,d1;
string st;
int main()
{
    getline(cin,st);
    d=st.length();
    while (st[0]==32)
    {
       st.erase(0,1);
    }
    while (st[d-1]==32)
    {
        st.erase(d-1,1);
    }
    d1=st.length();
    for (i=0; i<d1; i++)
        if ((st[i]==32) && st[i+1]==32)
        {
            st.erase(i,1);
            i--;
        }
    cout<<st;
    return 0;
}