linux1% g++ input2.cpp

linux1% cat data2
Hello     World     
   good
3.14159
linux1% ./a.out < data2
str1 = 'Hello     World     '
str2 = 'good'
linux1%