Linux words

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

A Linux Word is a word that consists of only the letters L, I, N, U, and X in that exact relative order. There must be exactly one L, exactly one I, one or more Ns, exactly one U and exactly one X. Case does not matter. For example, "Linux", "Linnnux" are linux words, whereas "Llinux", "Linuxx" are not.

You are given a String word which you must turn into a Linux Word. For each character in word, you can either replace it with a different letter or leave it unchanged. No other operations, like inserting new characters or deleting existing characters, are allowed. Printing the minimal number of characters you must replace to get a Linux Word. If it's impossible, print -1.

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

linmorktgggzzlkldux
Linnnnllux
snlsdldlluxee
LinNznnclzrlF
linnnUx
LuMNdnnYNiyNLInNXBoqQxNSe
LInnNNnnNNnNNnnNnNnNNnNNnnnnnux
llinn
linUx
bCb
lUx
EkdSLIWDNkKqlyFlrqmizsnBFuBtkKnXWWqQlNWNXWYnrrMEtd
LLLLLLLLLinnnnux
lINnnNnNNnnrNxNnNnuNnnNNQnNNnnHuX
lNtNxKNNNNNNMennncgjNNlCgJnCNld
gBttNSeXbnBClD
llllllllllllllliux
elinl
LLLLLLLLLLL
linlux
nnxyz
L
l
lDFqnNjTWLInmLinxunjNZNqnlibq
Linux
nnlinllliSNNNNEEELL
linld
liSVnkNNhe
lL
ynNeOSnCnqrnNNMNNNWCFcNynNNdFTnnnBLiznJCUxnOnuX
LiNnnNNnnnnNnNNnnnnnnNNnNNnnNNnNNnNNnnnnnNnNNnNLE
Stliux
nnnn
TonCodeer
llinnnnnux
linRux
lllllllinnnnnnnnlllllllluxeeeeee
LILE
dnnunHNncnNnbLK
lIllbnclUx
x
linuxs
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
linne
lccccccccux
LLLLL
q
lsd
LLINux
Q
LinNncnDNnnnNNHj
lInNnLE
nnnnnnnnnn
jNynvGKlgwjfKsSJf
bL
lHRNNnuXWKCXvknnUobNLE
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
luxnnn
LiNNNnknNnnuX
Codecracker
slinfsdfux
LL
lINnTnnnNNnnNnNNNnNnnnVuX
LYYynoNNNShNqNnTdCNJnNNNnnHORnNUe
linuxnnnn
liliux
linnnnlux
linnnlinnnnlux
LINLL
SLLSL
lddux
lilux
nnlux
lwLuxmNTrJNonnOUHLiMnNTNnGUNrvNIzjtNRlOO
CqFX
nliux
liNnNNuX
lllinnnlluxeee
linnnnUx
RNgInNBfWnNxNmNnjEENrHynuNQjIMBnCnNlb

Sample output:

14
2
13
7
0
16
0
4
0
-1
-1
44
9
5
16
12
15
5
10
1
5
-1
-1
20
0
14
2
5
-1
26
2
4
-1
8
2
1
23
-1
8
5
-1
3
4
2
8
4
-1
-1
2
-1
4
2
4
16
-1
15
50
4
1
11
7
-1
2
15
4
2
1
3
2
5
2
1
3
28
-1
3
0
10
0
24

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1yvl660.02502010/10/26 13:53:004B / 28B / 33B
2leonid710.04102010/10/26 13:59:560B / 30B / 41B

Perl _

RankUserSizeTimeDateStatistics
1tybalt89530.03772010/10/15 23:44:541B / ?B / ?B
2teebee530.00482010/10/30 07:13:451B / ?B / ?B

Python _

RankUserSizeTimeDateStatistics
1recursive930.03742010/10/28 05:21:050B / 55B / 35B
2hallvabo940.02902010/10/17 22:11:040B / 56B / 36B
3croyal1330.03592010/10/15 01:52:160B / ?B / ?B
4hallvabo (recursive)910.03222010/10/29 00:28:210B / 54B / 35B

PHP _

RankUserSizeTimeDateStatistics
1o-cn1150.04492010/10/15 13:48:210B / 71B / 44B

Common LISP _

RankUserSizeTimeDateStatistics
1kozima1180.09682010/10/19 17:38:440B / 71B / 42B

Arc _

RankUserSizeTimeDateStatistics
1pooq1042.11112010/10/15 13:35:480B / 35B / 67B

Clojure _

RankUserSizeTimeDateStatistics
1croyal4902.51042010/10/22 00:44:510B / ?B / ?B

Io _

RankUserSizeTimeDateStatistics
1pooq1060.16672010/10/15 07:31:030B / 41B / 65B

JavaScript _

RankUserSizeTimeDateStatistics
1nn920.07962010/10/26 08:42:530B / 43B / 47B
2idealmachine1000.00762010/10/24 10:25:100B / 47B / 53B
3croyal2620.00642010/10/15 03:45:570B / ?B / ?B

Lua _

RankUserSizeTimeDateStatistics
1yamaya(embed)1250.02712010/10/26 12:48:330B / 96B / 26B
2pooq1270.00022010/10/15 22:32:110B / 51B / 73B
3yamaya1370.01562010/10/26 12:51:400B / 79B / 49B

Prolog _

RankUserSizeTimeDateStatistics
1pooq1170.05442010/10/15 07:56:340B / 41B / 75B

BASIC _

RankUserSizeTimeDateStatistics
1pooq1170.00032010/10/15 04:59:310B / 44B / 71B

J _

RankUserSizeTimeDateStatistics
1I., S.660.03612010/10/24 21:33:400B / 21B / 44B
2pooq950.08272010/10/15 04:57:2438B / 30B / 24B
3I., S.590.03292011/10/02 21:30:510B / 21B / 37B

C _

RankUserSizeTimeDateStatistics
1kou1130.01082010/10/28 09:21:474B / 48B / 60B
2nn1140.00082010/10/26 22:34:254B / 51B / 58B
3yuyarin1200.00062010/10/17 07:03:154B / 54B / 61B
4tanakh1220.01112010/10/24 05:31:494B / 56B / 60B
5yuyarin(no bin)1230.00062010/10/21 09:33:000B / 61B / 62B
6inaniwa1250.00062010/10/20 13:32:280B / 64B / 60B
7chocobi1410.00062010/10/20 19:13:080B / 75B / 65B
8croyal3160.00062010/10/21 06:07:010B / ?B / ?B
9nn(kou)1070.01742010/10/30 13:49:014B / 49B / 53B

C++ _

RankUserSizeTimeDateStatistics
1croyal3160.00072010/10/21 06:17:590B / ?B / ?B

OCaml _

RankUserSizeTimeDateStatistics
1m.ukai1360.06302010/10/15 10:22:360B / 102B / 31B
2m.ukai (embed)2070.03292010/10/15 10:12:460B / 111B / 17B

Pascal _

RankUserSizeTimeDateStatistics
1*yuko*1410.00342010/10/28 06:47:240B / 53B / 83B

Fortran _

RankUserSizeTimeDateStatistics
1*yuko*1210.00992010/10/28 06:43:160B / 35B / 86B

Maxima _

RankUserSizeTimeDateStatistics
1pooq1290.21052010/10/15 12:17:130B / 51B / 77B

REBOL _

RankUserSizeTimeDateStatistics
1pooq1220.10292010/10/15 17:43:100B / 52B / 67B

AWK _

RankUserSizeTimeDateStatistics
1yamaya840.00182010/10/23 16:49:020B / 36B / 48B

Bash _

RankUserSizeTimeDateStatistics
1narb610.01962010/10/24 11:22:340B / ?B / ?B
2yamaya(embed)1140.02762010/10/26 18:00:0275B / 19B / 11B
3idealmachine1180.03562010/10/24 07:09:2773B / ?B / ?B
4yamaya1221.43672010/10/22 23:28:580B / 43B / 65B
5idealmachine(not cheating)1600.41952010/10/22 07:56:330B / 57B / 86B
6yamaya1110.10672010/10/29 22:16:160B / 93B / 15B

Zsh _

RankUserSizeTimeDateStatistics
1narb610.02442010/10/24 13:15:360B / ?B / ?B

Fish _

RankUserSizeTimeDateStatistics
1narb610.05112010/10/24 13:15:410B / ?B / ?B

GolfScript _

RankUserSizeTimeDateStatistics
1narb460.09012010/10/28 20:46:490B / ?B / ?B

gs2 _

RankUserSizeTimeDateStatistics
1whio300.10922017/06/13 06:36:1211B / 16B / 3B

FlogScript _

RankUserSizeTimeDateStatistics
1milieu480.75962010/10/15 22:28:040B / ?B / ?B

z80 _

RankUserSizeTimeDateStatistics
1*yuko*740.00162010/10/28 14:12:0338B / 19B / 14B
2*yuko*700.09702011/09/18 21:31:2436B / 19B / 14B

DOS _

RankUserSizeTimeDateStatistics
1chocobi1290.96692010/10/15 22:28:48106B / 9B / 7B

Vim _

RankUserSizeTimeDateStatistics
1nn970.17822010/10/16 21:57:312B / 46B / 45B

Groovy _

RankUserSizeTimeDateStatistics
1nn1043.66542010/10/26 22:02:010B / 66B / 36B

Language Ranking_

RankLangUserSizeScore
1gs2whio3010000
2GolfScriptnarb466521
3FlogScriptmilieu486250
4Perltybalt89535660
5JI., S.595084
6Bashnarb614918
7Zshnarb614918
8Fishnarb614918
9Rubyyvl664545
10z80*yuko*704285
11AWKyamaya843571
12Pythonhallvabo (recursive)913296
13JavaScriptnn923260
14Vimnn973092
15Arcpooq1042884
16Groovynn1042884
17Iopooq1062830
18Cnn(kou)1072803
19PHPo-cn1152608
20BASICpooq1172564
21Prologpooq1172564
22Common LISPkozima1182542
23Fortran*yuko*1212479
24REBOLpooq1222459
25Luayamaya(embed)1252400
26Maximapooq1292325
27DOSchocobi1292325
28OCamlm.ukai1362205
29Pascal*yuko*1412127
30C++croyal316949
31Clojurecroyal490612

return top