Briefing
Given a Fully Qualified Java Class/ Package name, you must shorten it as such:
Each part of the dot separated package will be shortened to it's first letter, apart from the last section and the class (if it exists).
package names will be all lower case, and the class (if it exists) will start with a capital letter and be UpperCamelCase. packages come in the form of:
foo.bar.foo
and
foo.bar.foo.Class
Examples
(No Class)
Input com.stackoverflow.main
Output c.s.main
(Class)
Input com.google.parser.Gson
Output c.g.parser.Gson
(Class)
Input com.google.longer.package.TestClass
Output c.g.l.package.TestClass
Rules
- Shortest code in bytes wins
- Standard loopholes apply
fantastic.foo.func.bar
becomef.f.f.bar
or is it guaranteed that 2 packages can't start with the same letter? \$\endgroup\$f.f.f.bar
would be correct. \$\endgroup\$