Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

Need help. Way Too Long Words

Revision en4, by basecamper, 2020-10-20 18:56:43

Hello,

I am trying to solve A. Way Too Long Words in C# (I already have a solution in c++).

https://codeforces.com/problemset/problem/71/A

I used the example given in the problem section in order to check my code. If I input n = 1 and check each string individually, I get correct answers.

When n = 4 like in the example, it gives a wrong answer.

Test: #1, time: 78 ms., memory: 0 KB, exit code: 0, checker exit code: 1, verdict: WRONG_ANSWER Input 4 word localization internationalization pneumonoultramicroscopicsilicovolcanoconiosis Output word o9nn17nn42s Answer word l10n i18n p43s Checker Log wrong answer 2nd words differ — expected: 'l10n', found: 'o9nn17nn42s'

Thank you

basecamper

using System;

namespace Way_Too_Long_Words

{

class Program { static void Main(string[] args)

{
        int n;

        n = int.Parse(Console.ReadLine());

        int i = 1;

        while (i <= n)
        {
            string inputName = Console.ReadLine();

            if (inputName.Length > 10)
            {
                Console.Write(inputName[0]); Console.Write(inputName.Length - 2); Console.Write(inputName[inputName.Length - 1]);
                Console.Read();
            }
            else
            {
                Console.WriteLine(inputName);
                Console.Read();
            }

            i++;
        }
    }
}

}

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English basecamper 2020-10-20 18:56:43 4
en3 English basecamper 2020-10-20 18:56:03 8
en2 English basecamper 2020-10-20 18:55:08 558
en1 English basecamper 2020-10-20 17:50:21 1290 Initial revision (published)