Language: Java

#include <bits/stdc++.h>
using namespace std;

map<string, bool> m;

long long palin(string str, int n)
{
	long long cnt = 1;
	string dp[n+5][n+5];
	m[str] = true;
	for (int i=0;i<n;++i) dp[i][i] = str;
	for (int i=0;i<n-1;++i)
	{
		dp[i][i+1] = str;
		swap(dp[i][i+1][i], dp[i][i+1][i+1]);
		if (!m[dp[i][i+1]])
		{
			m[dp[i][i+1]] = true;
			++cnt;
		}
	}
	for (int gap=2;gap<n;++gap)
	{
		for (int i=0;i<n-gap;++i)
		{
			int j = gap+i;
			dp[i][j] = dp[i+1][j-1];
			swap(dp[i][j][i], dp[i][j][j]);
			if (!m[dp[i][j]])
			{
				m[dp[i][j]] = true;
				++cnt;
			}
		}
	}
	return cnt;
}

int main()
{
	string a;
	cin >> a;
	int n = a.size();
	cout << palin(a, n) << endl;
	return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
map<string, bool> m;
^
  (use --enable-preview to enable unnamed classes)
Main.java:6: error: class, interface, enum, or record expected
long long palin(string str, int n)
^
Main.java:9: error: class, interface, enum, or record expected
	string dp[n+5][n+5];
	^
Main.java:10: error: class, interface, enum, or record expected
	m[str] = true;
	^
Main.java:11: error: class, interface, enum, or record expected
	for (int i=0;i<n;++i) dp[i][i] = str;
	^
Main.java:11: error: class, interface, enum, or record expected
	for (int i=0;i<n;++i) dp[i][i] = str;
	             ^
Main.java:11: error: class, interface, enum, or record expected
	for (int i=0;i<n;++i) dp[i][i] = str;
	                 ^
Main.java:12: error: class, interface, enum, or record expected
	for (int i=0;i<n-1;++i)
	^
Main.java:12: error: class, interface, enum, or record expected
	for (int i=0;i<n-1;++i)
	             ^
Main.java:12: error: class, interface, enum, or record expected
	for (int i=0;i<n-1;++i)
	                   ^
Main.java:15: error: class, interface, enum, or record expected
		swap(dp[i][i+1][i], dp[i][i+1][i+1]);
		^
Main.java:16: error: class, interface, enum, or record expected
		if (!m[dp[i][i+1]])
		^
Main.java:19: error: class, interface, enum, or record expected
			++cnt;
			^
Main.java:20: error: class, interface, enum, or record expected
		}
		^
Main.java:22: error: class, interface, enum, or record expected
	for (int gap=2;gap<n;++gap)
	               ^
Main.java:22: error: class, interface, enum, or record expected
	for (int gap=2;gap<n;++gap)
	                     ^
Main.java:24: error: class, interface, enum, or record expected
		for (int i=0;i<n-gap;++i)
		             ^
Main.java:24: error: class, interface, enum, or record expected
		for (int i=0;i<n-gap;++i)
		                     ^
Main.java:27: error: class, interface, enum, or record expected
			dp[i][j] = dp[i+1][j-1];
			^
Main.java:28: error: class, interface, enum, or record expected
			swap(dp[i][j][i], dp[i][j][j]);
			^
Main.java:29: error: class, interface, enum, or record expected
			if (!m[dp[i][j]])
			^
Main.java:32: error: class, interface, enum, or record expected
				++cnt;
				^
Main.java:33: error: class, interface, enum, or record expected
			}
			^
Main.java:37: error: class, interface, enum, or record expected
}
^
Main.java:42: error: class, interface, enum, or record expected
	cin >> a;
	^
Main.java:44: error: class, interface, enum, or record expected
	cout << palin(a, n) << endl;
	^
Main.java:45: error: class, interface, enum, or record expected
	return 0;
	^
Main.java:46: error: class, interface, enum, or record expected
}
^
30 errors