[ create a new paste ] login | about

Link: http://codepad.org/3Sigcn57    [ raw code | output | fork ]

C++, pasted on Feb 18:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string a,b;
	getline(cin, a);
	int i = a.size() - 1;
	while (a[i] != ' ')
	{
		i--;
	}
	b = a.substr(i + 1, a.size() - i);
	a = a.substr(0, i);
	cout << b << endl;
	cout << a;
	return 0;
}


Output:
1
2
3
/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.h:705: typename _Alloc::rebind<_CharT>::other::reference std::basic_string<_CharT, _Traits, _Alloc>::operator[](typename _Alloc::rebind<_CharT>::other::size_type) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]: Assertion '__pos <= size()' failed.

Disallowed system call: SYS_kill


Create a new paste based on this one


Comments: