Created
March 28, 2013 16:25
-
-
Save lifez/5264606 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <string.h> | |
| int main(){ | |
| int limit; | |
| char word[50]; | |
| scanf("%d",&limit); | |
| while (limit>0){ | |
| scanf("%s",&word); | |
| if(strlen(word)>10){ | |
| printf("%c%d%c\n",word[0],strlen(word)-2,word[strlen(word)-1]); | |
| limit--; | |
| } | |
| else{ | |
| printf ("%s\n",word); | |
| limit--; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| public class waytolongword { | |
| public static void main(String[] arg){ | |
| Scanner in = new Scanner(System.in); | |
| int limit; | |
| String word; | |
| limit = in.nextInt(); | |
| while (limit>0){ | |
| word =in.next(); | |
| char[] words = new char[100]; | |
| words = word.toCharArray(); | |
| if (word.length()>10){ | |
| System.out.format("%s%d%s\n",words[0],word.length()-2,words[word.length()-1]); | |
| } | |
| else{ | |
| System.out.format("%s\n",word); | |
| } | |
| limit--; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| limit = input() | |
| for i in range(limit): | |
| word = raw_input().strip() | |
| if len(word)>10: | |
| print word[0]+str( len(word)-2)+word[-1] | |
| else: | |
| print word |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| limit =gets.chomp() | |
| limit = limit.to_i | |
| while limit>0 | |
| word = gets.chomp() | |
| if word.length>10 | |
| print word[0],word.length-2,word[-1] | |
| print "\n" | |
| else | |
| puts word | |
| end | |
| limit-=1 | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment