Can you read this?

What is wrong in this code?

hello @shubhangis248
a) in ur else part of function ,u need to terminate ur output array with null character.

b) input=input+i+1 will skip the ith character from the input so correct that as well

runguard: warning: timelimit exceeded (wall time): aborting command
runguard: warning: command terminated with signal 15
now showing this error

first ignore this->

then see what output u r getting.
and then make changes accordingly


still showing wrong output

pls do dry run of ur previous code to understand why it is giving tle.

check ur updated code hre ->

Through your updated code it is passing only one test case for rest it is showing wrong ans

i will check why it is failing. till then try this->

iterate the string from 0 to last index.
    a) if current character belongs to { 'A'....'Z } then print newline character
   
   b) print current character

still not passing test cases

pls share ur updated code with me

no u got me wrong by this ->

i mean to say this->

 #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
for(int i=0;i<s.size();i++){
	if(s[i]>='A' && s[i]<='Z')
	   cout<<"\n";


	   cout<<s[i];
}


}

did what you told but still not passing test cases

it is passing all cases ->
image

and this is the code->