Những câu hỏi liên quan
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.

Bình luận (0)
NGUYỄN VIẾT LUẬN
Xem chi tiết
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;
}

 

Bình luận (1)
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;

}

Bình luận (0)
Ngô Chí Thành
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 4 2021 lúc 9:40

Uses crt;

Var st:string;

I,d:integer;

Begin

Clrscr;

Write('nhap xau:'); readln(st);

D:=length(st);

While st[d]=#32 do

Begin

Delete(st,d,1);

D:=length(st);

End;

For i:=1 to d do

If (st[i]=#32) and (st[i+1]=#32) then delete(st,i,1);

Writeln(st);

Readln;

End.

Bình luận (0)
Ngô Chí Thành
Xem chi tiết
Nguyễn Lê Phước Thịnh
9 tháng 4 2021 lúc 9:29

Uses crt;

Var st:string;

I,d:integer;

Begin

Clrscr;

Write('nhap xau:'); readln(st);

D:=length(st);

While st[d]=#32 do

  Begin

Delete(st,d,1);

D:=length(st);

End;

For i:=1 to d do

  If (st[i]=#32) and (st[i+1]=#32) then delete(st,i,1);

Writeln(st);

Readln;

End.

Bình luận (0)
NGUYỄN VIẾT LUẬN
Xem chi tiết
Lê Hoa
Xem chi tiết
Nguyễn Lê Phước Thịnh
30 tháng 12 2020 lúc 22:33

uses crt;

var st:string[50];

d,i:integer;

begin

clrscr;

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

d:=length(st);

for i:=1 to d do 

  if st[i] in ['a'..'z'] then write(st[i]:4);

readln;

end.

Bình luận (0)
Nguyễn Hoàng Nam
Xem chi tiết
Nguyễn Lê Phước Thịnh
15 tháng 3 2022 lúc 22:17

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

readln(st);

d:=length(st);

for i:=1 to d do 

  if (st[i]='a') or (st[i]='A') then st[i]:='b'

writeln(st);

readln;

end.

Bình luận (0)