JUNE COOKOFF(EXAM1)

why iam getting runtime error ??
can any one tell plzz

my solution is

https://www.codechef.com/viewsolution/24923567

Although i am not much familiar with scanf and printf but its is line 13 and 14 which is giving error. just use character array instead of string object to avoid this.

see format specifier at line 12

Since you are using c++ ,try using cin for input and cout for output rather than scanf and printf.
line 13 could be written as cin>>str1; and it would work:grinning:

why iam unable to see problem in practise session…I tried yesterday but i get runtime error???can anyone tell reason plz??

scanf() can’t take input of string data type , that is why you are getting a runtime error.

use this instead:-
string str1;
cin>>str1;

In the 12th line, you have written:
scanf("%N",&N);
which must be modified to
scanf("%d",&N);

On line number 12, you have use wrong format specifier. If you code in c++ then I suggest you to use cin and cout for I/O. And also, check your condition sequence.