import java.util.*;

import java.util.regex.*;

class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		String regex = "(\\d+)\\.(\\d+)(?:\\.(\\d+))?";
		Pattern p = Pattern.compile(regex);
		
		String s1="3.2.1";
		Matcher m1 = p.matcher(s1);
		String result1 = m1.replaceAll(x ->
			x.group(3) != null ? "OGNL_" + x.group(1) + "_" + x.group(2) + "_" + x.group(3) :
			  "OGNL_" + x.group(1) + "_" + x.group(2) );
		System.out.println(result1);
		
		String s2="3.2";
		Matcher m2 = p.matcher(s2);
		String result2 = m2.replaceAll(x ->
			x.group(3) != null ? "OGNL_" + x.group(1) + "_" + x.group(2) + "_" + x.group(3) :
			  "OGNL_" + x.group(1) + "_" + x.group(2) );
		System.out.println(result2);
	}
}