Following works as expected for me:
#include <iostream>
using namespace std;
int main()
{
string input;
cin.clear();
getline(cin, input);
cout << input.length() << '\n';
}
Which prints
0
when only the enter key is hit. That's a fairly old WSL 1 instance on a VmWare Windows 10 system, but I'd be surprised if things have changed between WSL 1 and WSL 2. If the above does not work, then either MS has bungled WSL, or there's something odd with your WSL instance. If it does work for you, then it suggest that there's something going on elsewhere in your program.