Message from C, C++ discussions

December 2019

— Hello?

— 

Words with Length N


The program must accept a  space separated string S and an integer N as
the input. The program must print the words from S which are of length N
as the output. If no word is of length N then the program must print -1 as the output.


Boundary Condition(s):

1 <= Length of S <= 1000


Example Input/Output 1:

Input:

Have a good day

4


Output:

Have good


Example Input/Output 2:

Input:

help the need

2


Output:

-1

— See this

— The output is empty for this input..can anyone pls chk

— Read something about scanf first, prior to using it

— Scanf never returns EOF

— I tried ==1 also

— Https://en.cppreference.com/w/cpp/io/c/fscanf

— You can't do accidental programming with C++ or C, must learn first

— The rest of the code is also a pice of rave.

— It will not work

— Y..it is working for small strings 😏