Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

7 of 8
added 56 characters in body
Dave
  • 161
  • 4

PHP, 195 bytes

Added the > 2 character restriction:

<?$a=$argv[1];$r=substr($a,-2,1)=="\n"?strrev($a):$a;foreach(explode("\n",$r)as$l){$s=strlen($l);
$x[$s]=++$i;$m=$i==$s?T:M;}$z=count($x);echo$i*$z>2?$z==1&&key($x)==$i?S:($z==1 && $i>2?R:$m):M?>

The upside down triangle adds an expensive 56 bytes to this!

Outputs are S,R,T,M

Saved a few bytes thanks to Dom Hastings. Wasted a couple to make it shapely ;)

Try it online!

Dave
  • 161
  • 4

AltStyle によって変換されたページ (->オリジナル) /