71A_Codeforces

Run Settings
LanguagePython
Language Version
Run Command
def wayTooLongWords(list_of_words): result = '' for word in list_of_words: if len(word) <= 10: result += word + '\n' else: result += word[0] + str(len(word)-2) + word[len(word)-1] + '\n' return result if __name__ == '__main__': word = int(input()) list_of_words = [] for _ in range(0,word): list_of_words.append(input()) print(wayTooLongWords(list_of_words))
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Codeforces_71A { private static void wayTooLongWords(int input,List<String> lst) { //System.out.println(input); for(String l : lst) { if(l.length()> 10) { System.out.print(l.charAt(0)); System.out.print(l.length()-2); System.out.println(l.charAt(l.length()-1)); } else { System.out.println(l); } } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int input = sc.nextInt(); List<String> lst = new ArrayList<String>(); for(int i=0;i<input;i++) { lst.add(sc.next()); } wayTooLongWords(input,lst); } }
Editor Settings
Theme
Key bindings
Full width
Lines