#!/usr/bin/perl -w

use strict;

while(<>) {
    last if (m/lyricmode/);
}

my $nn;
my $yy;
my $zz;
while(<>) {
    last if (m/}/);
    tr/ \t\r\n/ /s;
    s/^ //;
    s/ $//;
    next if (m/^$/);

    if (m/stanza = #"(\d+)/) {
	$nn = $1;
	if ($nn == 1) {
	    $yy = "a";
	} else {
	    $yy++;
	}
	$zz = "a";
	next;
    }

    print "l$yy$zz = \\lyricmode { \\set stanza = #\" $nn$zz \" $_ }\n";

    $zz++;
}
