Advertisement
MkArs

Untitled

Nov 14th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. package drob;
  2.  
  3. import java.util.*;
  4.  
  5. public class Constructor {
  6.  
  7. public static void main(String[] args) {
  8. System.out.print("Строка: ");
  9. Scanner s = new Scanner(System.in);
  10. String str = s.nextLine();
  11.  
  12. int k=s.nextInt();
  13. String temp;
  14. String []words=str.split("[\\s\\.\\!\\,]");
  15. for(int l=0;l<words.length;l++){
  16. System.out.print("");
  17. if(k<words[l].length()){
  18. temp="";
  19. temp+=words[l].substring(0, k-1);
  20. temp+='@';
  21. temp+=words[l].substring(k,words[l].length());
  22. words[l]=temp;
  23. }
  24. System.out.print(" "+words[l]);
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement