I am given an ambiguous amount of text and must make all the letters lowercase. But my output is empty for no good reason.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>
using namespace std;
int main()
{ string test;
for (int i=0; i<100;i++)
{
getline(cin, test);
test.erase(remove_if(test.begin(), test.end(), [](char ch)
{ return ::isspace(ch) || ::ispunct(ch);}), test.end());
transform(test.begin(), test.end(), test.begin(), ::tolower);
cout<<test<<endl;
}
return 0;
}
|
sample input:
d;rR9s$<4kc(yo`";`U<~1ABg'6J%z-qFP5WK@m2y$v>85NQ3LH55cV7;c;p@t
x/w*1%/ [x$%i/c=rzjZ0Y*s;61{g<Zq!pbE1s#}YhLwv@Bddd3>h7A>u6N)BD$SXl
AlwaYS ALIvE
%EDC?KNc Am_zQ<GWQnEs7jYB%`#Fr9:L4U$Lm.1A]ctKo:[1V~1M)eAZ
This is some text
qRd P>;w'C&eF*5el,!D<*G*TAlH?1H9|Yxv8JIGg(#|wlrI$%Nr+o6pSfH-)RRur!_frD"O
ludE\JZl'<vQOfj$XtST0Z]g9%et{9C~;ji# =<O~iuZoUW:zZ/Q@jj|^;v
o~tR.+1uC{OLm^X3 3&UE`T~
,*:*t968%3h]hnps1ku9DEh"',2,M`aJFu<)
O1RtlQ F'/nYsbo~2n )H|a\FJ^^
HELLO CODEEVAL
6:Aa+Q'\%<U.irexf?-BFh{-%)6;a2PIshm/vRc&kB|jDi+\3A,3*GW7nz82Z2VF
F~]SEeFrP#nU(/0,.bwG8p2A
q~g%W.Bu:[nhqOsU(wUEdA4M1xvVE$_wTl,Uu"JMbY|;6z+xI\&x]$&AE@mGgX2Q%e{}7HjV`x,'
}oFCY+@RDCR><RZW+GskAh1nV`A]n7u^,$V3
.Q1zkt)~Z2FW-!tH9T+O7dV0DZHV6W!S,?37J;?P1>fv==S_Z`.`~nO.~KsVdE1)v
&FkE+ x1nbCgD(,Q#_`d6m{:ms18VVAT[J,o;AyE0
Zv/dfuHJNS^>Jv.~Q~^@
Quick Fox JUMps thE FencE
t$oxir'.S:L?H1OG`=2Zz*T-X(7S:%iW+akqtq`IZy{]
Output:
[nothing]
From CodeEval
Any suggestions?