@asics
Freelance
2853 / 1788 / 144
Регистрация: 09.09.2010
Сообщений: 3,841
|
15.03.2011, 20:31
|
|
C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| #include <iostream>
#include <string>
#include <sstream>
int main(){
std::string prompt("Hello, my name is Bond...James Bond."), del(" .,?!"), tail;
const size_t n = 4;
for(size_t i = 0; i < prompt.length(); ++i)
if(del.find(prompt[i]) != std::string::npos)
prompt[i] = ' ';
std::istringstream ist(prompt);
while(ist >> tail)
std::cout << ( tail.length() <= n? tail + " " : "");
return 0;
} |
|
2
|