Can anyone tell me what mistake I’m making in this code?
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define m 1000000007
#define pd push_back
#define f(a,b,c) for(int i=a;i<b;i+=c)
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t=1; while(t--)
{
string s;
getline(cin,s);
string smal;
int si = INT_MAX;
vector<string> v;
string temp = "";
for(int i=0;s[i];i++)
{
if(s[i]==' ')
{
v.pd(temp);
if(si > temp.size())
{smal = temp; si=temp.size();}
temp = "";
}
else{
temp+=s[i];
}
}
if(si > temp.size())
smal = temp;
v.pd(temp);
for(auto val:v)
{cout<<smal<<" ";
cout<<val<<" ";}
cout<<smal<<" ";
}
return 0;
}