Skip to content

Instantly share code, notes, and snippets.

@IgorVodka
Created December 23, 2016 14:13
Show Gist options
  • Select an option

  • Save IgorVodka/27ddea92dffb8110c1a37caf4a3496cf to your computer and use it in GitHub Desktop.

Select an option

Save IgorVodka/27ddea92dffb8110c1a37caf4a3496cf to your computer and use it in GitHub Desktop.
// ConsoleApplication4.cpp: определяет точку входа для консольного приложения.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
char* buf = new char[81];
cin.getline(buf, 80);
bool used[256] = { 0 };
while (*buf != '\0') {
if (*buf >= 'a' && *buf <= 'z') {
if (!used[*buf]) {
cout << *buf;
used[*buf] = true;
}
}
else if (*buf == ' ' && (*(buf - 1) != ' ')) {
cout << ' ';
memset(used, 0, 256 * sizeof used[0]);
}
buf++;
}
system("pause > nul");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment